I am trying to pull back just specific columns in a list using the .NET client object model. (i.e. using Microsoft.SharePoint.Client;)

This is the CamlQuery specifying just fields in the DefaultView ViewFields for the list

        <FieldRef Name="LinkTitle" />
        <FieldRef Name="FoodName" />

However, when I run the query using:

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><ViewFields><FieldRef Name="LinkTitle" /><FieldRef Name="FoodName" /></ViewFields></View>";
ListItemCollection items = list.GetItems(camlQuery);

then each item's FieldValues has the following keys (columns) pulled back:

  • FoodName
  • MetaInfo
  • _ModerationStatus
  • _Level
  • ID
  • UniqueId
  • owshiddenversion
  • FSObjType
  • Created_x0020_Date
  • Created
  • Title
  • FileLeafRef
  • Modified
  • FileRef

Why is SharePoint pulling back these additional field values?

3 Answers 3


Update for client object model:

In client object model only specifying ViewFields is not enough. You need to combine it with a linq statement like this:

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Where><Eq>.<FieldRef Name='Country' /><Value Type='Text'>Belgium</Value></Eq></Where></View>";
ListItemCollection listItems = spList.GetItems(camlQuery);
  items => items.Include(
  item => item.Id,
  item => item.DisplayName,
  item => item.HasUniqueRoleAssignments));

Source: http://karinebosch.wordpress.com/2012/02/03/caml-and-the-client-object-model/

  • That example is not using the SharePoint client object model. And actually, I'm not convinced my syntax is wrong for the CamlQuery.ViewXml syntax, if I specify just the fieldRef elements (<FieldRef Name="LinkTitle" /><FieldRef Name="FoodName" />), I get even more fields returned.
    – Nathan
    May 31, 2013 at 19:37
  • Sorry about that, altered my answer May 31, 2013 at 19:47
  • 3
    Just for completeness sake, to get non-built in columns, you use the syntax clientContext.Load(listItems, items => items.Include(item => item["FoodName"], item => item["LinkTitle"]));
    – Nathan
    May 31, 2013 at 20:07
  • I think that you'll get the items anyway - the linq will just delete them after they are being fetched.
    – XristosK
    Nov 20, 2014 at 22:14

If you look here: http://karinebosch.wordpress.com/2012/02/03/caml-and-the-client-object-model/ under the section "ViewFields", you'll see the text: "But this also returns a number of system columns. If you really want to limit the columns returned to the columns you specify, you have to use a LINQ query within the Load method. The code looks as follows:"


This is a side note to the question... but it turns out that if you want non-field data such as EffectiveBasePermissions and HasUniqueRoleAssignments AS WELL AS item data from fields (e.g. Title, Modified by) you effectively call load on the listItems twice, as below:

"Include(EffectiveBasePermissions, HasUniqueRoleAssignments)");
// Follow the statement above with this if you need special "fields" like 
//  HasUniqueRoleAssignments, EffectiveBasePermissions as well as the normal fields
  • 1
    Hello and welcome to the community! While your answer seems to address the question asked, you should provide more context (see what I did there? :D) so that people reading it understand not just that it fixes the problem but why. As it stands your answer is not that helpful to someone who doesn't understand why you need to use your approach in the first place.
    – John-M
    Nov 20, 2014 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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