1

I have written a CAML query to return all items that have not been approved in a workflow. The query correctly returns the list items, but the person field that I need from the list item is not returned.

 CamlQuery keyColumnValuesQuery = new CamlQuery();
  keyColumnValuesQuery.ViewXml = "<View><Query><Where><Neq><FieldRef Name = 'WFLevel'/><Value Type = 'Text'>Complete</Value></Neq></Where></Query></View>";
 clientContext.ExecuteQuery();
foreach (ListItem oListItem in keyColumnValues)
Console.WriteLine(oListItem["Approver"]);

}

oListItem["Approver"] column is not returned with the other list item columns. The Approver column belongs to a custom content type and the default item content type. The list item column "Supervisor" that is part of the custom content type, but not item content type is returned. This is odd behavior. Does anyone know what I have to do to get all columns to be returned by the query?

Thanks in advance.

  • 1
    Try putting the column names to be retrieved in the ViewFields – Unnie Sep 16 '16 at 13:54
0

Thanks, Unnie. You are correct - adding the viewfields with the column I needed worked. I had used an include with linq previously for person fields and that retrieved the person field. I will use the viewfields method going forward.

Mark

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.