0

I use a simple CAML-Query to retrieve the contents of a list inside the Appweb. (But this isn't app-specific)

camlQuery.ViewXml = string.Format("<View><Query><Where><Contains><FieldRef Name='Title'/><Value Type='Text'>{0}</Value></Contains></Where></Query></View>", title);
 ListItemCollection items = currentList.GetItems(query);
                    clientContext.Load(items);
                    clientContext.ExecuteQuery();

I retrieve the content accessing items.FieldValues. While I get the content I want I also retrieve about 40 System-Values Like "WorkflowVersion, InstanceID" etc. that a normal user cannot see.

Because items.FieldValues is a simple Dictionary there is no Flag like "isSystemField" or something like that.

How can I make sure to only retrieve the fields that a normal user would see when accessing the list in the Backend?

Using ViewFields is not sufficant for this purpose as I need a more generic approach.

Update: I modified this solution by checking the tables fields and compare the result with my items:

foreach (var field in currentList.Fields) {
    if (!field.FromBaseType)
    {
       // do your action for "valuable" fields (non-system)
    }
}

This reduces the number of system fields, but there are still about 10 Fields left.

  • Have you tried specifying ViewFields? – wjervis Feb 16 '16 at 17:23
  • Thats no valid solution for me in this case as I want to use this as a generic method for any list. – Ole Albers Feb 17 '16 at 8:01
  • Could you add that detail to your question? That's a pretty significant one. – wjervis Feb 17 '16 at 11:27

Your Answer

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

Browse other questions tagged or ask your own question.