I'm using SPList.GetItems(string fields[]) to obtain only specific item fields from a document library:

 SPListItemCollection items = list.GetItems("UniqueId", "Name");

However, iterating the items collection reveals that I can easily access even fields that I didn't explicitly retrieve, while I would be expecting an exception:

foreach (var item in items)
    var id = item.UniqueId;
    var name = item.Name;
    var url = item.Url; // I didn't request this field yet here it is.. no exception thrown.

    Console.WriteLine("{0} {1} {2}", url, name, id); // normally displays every value                       

Why is that? Does SharePoint simply pull everything from the database if it encounters a parameter that hasn't been queried? Am I misunderstanding what 'fields' refer to here?

  • is there a typo on that code? shouldnt it be an array of strings you're passing in instead of just comma separated values? SPListItemCollection items = list.GetItems(new string[]{"UniqueId", "Name"});
    – Mauro
    Feb 14, 2014 at 16:40
  • @Mauro thanks but it's not a typo - the method accepts params string[], so comma-separated values are legit.
    – w128
    Feb 14, 2014 at 18:36

2 Answers 2


When you request list items via client object model, the object will return a number of parameters even if you specify none at all. Some of these include title, url, modified date, created date, check out user, etc. You can see these by storing the object as a variable and then using Dev tools to debug the page. You will see there are actually about a dozen properties that are returned for each item even if you request none at all.



Your code is fine.

Url is property of the item and its not affected by your parameter in GetItems.

Test with a field (not property) that is not included in the parameter you pass in GetItems.


Normally it should throw an exception (ArgumentException).

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.