The property or field 'Title' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
Usually we get this error when we try to use a property before calling ExecuteQuery();
clientContext.Load(ItemCollection);
clientContext.ExecuteQuery();
if
(ItemCollection!= null && ItemCollection.Count > 0)
{
item= ItemCollection[0];
}
when i try to get the field "Manager" i.e item["Manager"] i was getting the above error, so i modified the code as below:
clientContext.Load(ItemCollection);
clientContext.ExecuteQuery();
if (ItemCollection!= null && ItemCollection.Count > 0)
{
item= ItemCollection[0];
clientContext.Load(item);
clientContext.ExecuteQuery();
}
then its worked fine.
No comments:
Post a Comment