I'm trying to get a particular set of columns for items in a list, as well as RoleAssignments which is a non-default property.
Assuming my CAML, where I define my ViewFields, is in a variable CAMLtemplate
, I can get the desired columns:
clientContext.Load(CAMLtemplate);
clientContext.ExecuteQuery();
However when I add the additional properties, it seems I'm no longer getting the columns I've specified in my CAML:
clientContext.Load(CAMLtemplate,
iCol => iCol.Include(
item => item.RoleAssignments,
item => item.RoleAssignments.Include(
ra => ra.Member.LoginName,
ra => ra.RoleDefinitionBindings)));
clientContext.ExecuteQuery();
...I get an error when trying to work with a column I've requested in my CAML, like 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.
This seems to suggest that I either need to explicitly request every column in my iCol.Include
(seems crazy, there are lots of columns, and why bother with the CAML ViewFields if this is the case?), or do something else. How can I simply get the columns I want, as well as the additional property I want?