I have a list with 3 fields. I'm able to get the rows but in the returned XML if one of the fields is empty then the field is not in the XML. Is there anyway to get all fields I specify in ViewFields even empty ones?

This is what I've tried.

<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
            <FieldRef Name="field1" Nullable="True" />
            <FieldRef Name="field2" Nullable="True" />
            <FieldRef Name="field3" Nullable="True" />

It returns row, but if, for example, field1 is empty for one of the rows/items then it is not in the returned xml. I've spaced the below example out for clarity.)

<z:row ows_field1="hi" ows_field2="bye" ows_field3="one" />
<z:row ows_field1="hi"                  ows_field3="one" />
<z:row ows_field1="hi" ows_field2="bye"                  />
<z:row                 ows_field2="bye" ows_field3="one" />
<z:row ows_field1="hi" ows_field2="bye" ows_field3="one" />
  • Empty values in SharePoint are represented by NULL values (at least, in the object model). So that's why I guess it's omitted in the XML. But what's the issue? You could do some XML transformation to add the attributes to the XML. Yes, a bit "hacky", but it's do-able. – Boland Aug 6 '15 at 3:49
  • @Boland I will do that if I can't find another way. wanted to avoid it to keep my code small. thought their might be a better way to force including all fields? – IMTheNachoMan Aug 6 '15 at 3:55

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.