Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint Web Services Team Discussion and Replies

I am trying to get a discussion with all it's replies from the sharepoint web services but only seem to be able to get the root message and not any of the replies. Below is the soap XML. What am I missing?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:GetListItems>
         <!--Optional:-->
         <soap:listName>Team Discussion</soap:listName>

         <soap:viewFields>
                <ViewFields>
            <FieldRef Name='Title'/>
            <FieldRef Name='ItemChildCount'/>
            <FieldRef Name='Body'/>
        </ViewFields>
         </soap:viewFields>
         <soap:queryOptions>
        <QueryOptions>
           <Folder>
        "http://Lists/Team Discussion/Bite Me"
       </Folder>
        </QueryOptions>
         </soap:queryOptions>

      </soap:GetListItems>
   </soapenv:Body>
</soapenv:Envelope>

The reply is:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
         <GetListItemsResult>
            <listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
               <rs:data ItemCount="2">
                  <z:row ows_Title="Hello" ows_ItemChildCount="3;#1" ows_Body="&lt;div class=&quot;ExternalClass7B4989B3DC264716AD81B9CE55FD38FA&quot;>&lt;p>​The text of the message&lt;/p>&lt;/div>" ows_MetaInfo="3;#" ows__ModerationStatus="0" ows__Level="1" ows_ID="3" ows_UniqueId="3;#{6AF6D7DA-0D87-45EC-B002-AA0D153B6286}" ows_owshiddenversion="1" ows_FSObjType="3;#1" ows_Created="2012-01-11 12:21:26" ows_PermMask="0x7fffffffffffffff" ows_Modified="2012-01-11 12:21:26" ows_FileRef="3;#Lists/Team Discussion/Hello"/>
                  <z:row ows_Title="Bite Me" ows_ItemChildCount="1;#1" ows_Body="&lt;div class=&quot;ExternalClass76A3DB4368714038B6B75DB0D807240B&quot;>&lt;p>​Really?&lt;/p>&lt;/div>" ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_ID="1" ows_UniqueId="1;#{336518DC-B806-4DFB-9483-AB8DBB6258B6}" ows_owshiddenversion="1" ows_FSObjType="1;#1" ows_Created="2012-01-09 14:16:29" ows_PermMask="0x7fffffffffffffff" ows_Modified="2012-01-09 14:16:29" ows_FileRef="1;#Lists/Team Discussion/Bite Me"/>
               </rs:data>
            </listitems>
         </GetListItemsResult>
      </GetListItemsResponse>
   </soap:Body>
</soap:Envelope>

EDIT: Each of the above posts should also have a reply.

like image 273
eaglestorm Avatar asked Jan 26 '26 16:01

eaglestorm


1 Answers

I eventually found the magic query. It seems sub folders are only returned when you add a query based on date, i.e. this soap request works.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:GetListItems>
         <!--Optional:-->
         <soap:listName>969E0130-5727-4E7D-A908-B3A5BC447E24</soap:listName>

         <soap:viewFields>
                <ViewFields>
            <FieldRef Name='Title'/>
            <FieldRef Name='Created'/>
            <FieldRef Name='Author'/>
            <FieldRef Name='Body'/>
        </ViewFields>
         </soap:viewFields>

         <soap:query>
           <Query>
        <Where>
            <Geq>
                <FieldRef Name='Created' />
                <Value Type='DateTime'>2010-08-20T14:00:00</Value>
            </Geq>
        </Where>
        <OrderBy><FieldRef Name='ThreadIndex' Ascending='true' /></OrderBy>
      </Query>
         </soap:query>

    <soap:queryOptions>
           <QueryOptions>
        <ViewAttributes Scope="RecursiveAll" IncludeRootFolder="False" />
       </QueryOptions>
         </soap:queryOptions>
      </soap:GetListItems>
   </soapenv:Body>
</soapenv:Envelope>

The essential parts are the query element with the date and the query option to specify the query is recursive.

imho shouldn't need the query as it should return everything by default.

The folder option listed in the other article didn't make any difference for me.

like image 174
eaglestorm Avatar answered Jan 29 '26 14:01

eaglestorm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!