Unable to get all list fields using GetListItems in sharepoint web services

I want to get all the fields from each item in the list. The only way I found is to create a view containing all the fields. But I do not want to create a new view. I tried, but that doesn't seem to deserve it. If this worked, I could get all the fields with GetList and populate ViewFields based on this.

Is it possible to override the default view from an xml request? My current XML is below.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://schemas.microsoft.com/sharepoint/soap/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Body> <s0:GetListItems> <s0:listName xsi:type="s:string">{GUID}</s0:listName> <s0:QueryOptions> <s0:ViewAttributes Scope="Recursive"></s0:ViewAttributes> <s0:IncludeMandatoryColumns>TRUE</s0:IncludeMandatoryColumns> </s0:QueryOptions> <s0:Query></s0:Query> <s0:ViewFields> <s0:FieldRef xsi:type="s:string" Name="ID"></s0:FieldRef> <s0:FieldRef xsi:type="s:string" Name="CellPhone"></s0:FieldRef> <s0:FieldRef xsi:type="s:string" Name="FirstName"></s0:FieldRef> </s0:ViewFields> </s0:GetListItems> </soap:Body> </soap:Envelope> 
+4
source share
3 answers

I get it. For some reason, you should have a viewFields tag in the correct soap namespace. And it has a ViewFields tag (business is important).

 <s0:viewFields> <ViewFields> <s0:FieldRef ...> </ViewFields> </s0:viewFields> 
+4
source

Your view should have all the fields that you want to return. Your request should return a CAML request. The CAML request will determine the filter and sort.

A good tool to help with both ViewFields and CAML queries is the U2U CAML Query Builder. I am having trouble finding a link that is currently working, so you may have to look for someone yourself or go to another CAML query tool.

Kirk

+1
source

"For some reason"? An element is identified by a combination of a local name and a namespace. With a different namespace, this is a different element, even if it has the same local name.

+1
source

All Articles