Hello!
I sometimes have a problem wnen I work with CSOM for SharePoint Online.
I make this request :
var list = context.Web.Lists.GetById(listid);
item = list.GetItemById(id);
context.Load(item);
context.ExecuteQueryRetry();
context.Load(item, x => x, x => x.HasUniqueRoleAssignments, x => x.Id, x => x.ContentType.Id,
x => x.RoleAssignments, x => x.RoleAssignments.Include(y => y.RoleDefinitionBindings, y => y.PrincipalId));
context.ExecuteQueryRetry();
After that I try get LookupId :
((FieldLookupValue)item[TaskList.Expertise]).LookupId;
and I catch the error :
The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested. Stack: at Microsoft.SharePoint.Client.ListItem.GetFieldValue(String fieldName)
I don't understand, why doesn't this error happen all the time?It happens about twice a week.
I use Microsoft.SharePoint.Client, Version=16.1.0.0 and OfficeDevPnP.Core, Version=3.20.2004.0
Thanks!