1

I am using the GetListItems web service to query a list.

I am passing the viewFields property to return certain fields:

var viewFields = XElement.Parse(@"
  <ViewFields>
    <FieldRef Name='Field1' />
    <FieldRef Name='Field2' />
    <FieldRef Name='Field3' />
  </ViewFields>
  ");

var result = client.GetListItems(listname, null, null, viewFields, null, null, null);

The problem is when these fields are empty or null, SharePoint does not return them, even though they are specified in ViewFields. Am I missing anything? Thank you so much.

0

Are you using a field whose name exceeds 32 characters? There are problems with these fields names in SharePoint 2010 only when used in ViewFields clause.

  • Actually my fields do exceed 32 characters. Thanks! – user39730 Feb 21 '15 at 17:55
1

It's been a while since I've looked at this but I think you need to indicate the Field can be null or empty

  <ViewFields>
    <FieldRef Name='Field1' />
    <FieldRef Name='Field2' Nullable='True' />
    <FieldRef Name='Field3' Nullable='True' />
  </ViewFields>

Your Answer

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