views:

2208

answers:

3

I want to retrieve al the fields from each element in list. The only way I have found is to create a view that contains every field. But I don't want to create a new view. I have tried , but it does not seem to be honored. If it worked I could get all the fields with GetList and populate ViewFields based on that.

Is there a view to override the default view from the 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/"&gt;
  <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>
+1  A: 

Your ViewFields should contain all of the fields you want to return. Your Query should return the CAML query. The CAML query will determine the filter and sort.

A good tool to help with both the ViewFields and the CAML query is the U2U CAML Query Builder. I'm having trouble finding a link that works for that at the moment, so you might have to search some yourself or resort to someone else's CAML query tool.

Kirk

Kirk Liemohn
+2  A: 

I figured it out. For some reason you must have a viewFields tag in the correct soap namespace. And within it a ViewFields tag (case is important).

<s0:viewFields>
<ViewFields>
<s0:FieldRef ...>
</ViewFields>
</s0:viewFields>
Eirik Nygaard
+1  A: 

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

John Saunders
I am aware of that, what stumped me was that I had to have two tags with the same local name(but different case) inside each other, one with the soap namespace, and one without it.
Eirik Nygaard
FYI, XML is case-sensitive. With a different case, it's a different local name, hence a different name.
John Saunders