none
The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested RRS feed

  • Question

  • hi sir,

    I have try to update task assignments using csom model.

     erro message ::The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested

     foreach (PublishedAssignment assignItem in item.Assignments)
                            {
                                Guid id =assignItem.Id;
                               cc.Load(assignItem, a => a.Resource,a=>a.PercentWorkComplete);
                               cc.ExecuteQuery();

                               EnterpriseResource er = cc.EnterpriseResources.GetByGuid(assignItem.Resource.Id);

                           
                             
                             
                               cc.Load(item.Assignments,c=>c.Where(uu=>uu.Id==id).IncludeWithDefaultProperties( l=> l.Task.Assignments,l=>l.Work));
                               cc.ExecuteQuery();
                               er.Assignments.Single(ll => ll.Id == id).Work = "9";
                               cc.Load(er);
                               cc.ExecuteQuery();
                               StatusAssignmentCollection sac = er.Assignments;
                                
                               sac.Update();
                               sac.SubmitAllStatusUpdates("hello vijay");


    vijay

    Sunday, September 14, 2014 3:50 PM

All replies

  • Hi Vijay,

    You didn't load the 'er.Assignments' collection.

    Make sure it's loaded and it should work

    Hope this helps

    Monday, September 15, 2014 8:02 AM