SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed that for a particular list, calling GetListItems and passing null for the viewFields argument, I wasn't getting back all of the columns. Just a few were missing.

After some trial and error, I found that instead of passing null, I could pass in an empty XmlNode like this:

    (new XmlDocument()).CreateElement("ViewFields"), 

And that gives me all the columns.

I don't see why that is the case. I haven't found anything in the documentation to help me understand what's going on. I have used GetListItems many times on many lists but I've never seen it shortchange me on columns with a null viewFields until today.

Why would the GetListItems behave like this?


share|improve this question

Specifying null for both the view and the viewfields parameters returns the fields of the default view which may or may not have all the fields. By specifying an empty ViewFields element you are overriding that behavior and asking for all fields.


share|improve this answer
That's it! Thank you for your tip! Empty XMLNode gives all the SP-Columns, finally! – user8953 Jun 19 '12 at 12:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.