我正在从CXF调用list.asmx Web服务。
以下肥皂调用不会从列表子文件夹中返回文件。它返回folder1,folder2和file1.pdf

Shared Documents
  folder1
     file2.docx
     file3.pdf
  folder2
     sub-folder1
        file5.pdf
     file4.pdf
  file1.pdf

SOAP调用
POST /_vti_bin/lists.asmx HTTP/1.1 Accept-Encoding: gzip,deflate

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
   <soap:Header/>
   <soap:Body>
      <soap1:GetListItems>
         <soap1:listName>Shared Documents</soap1:listName>
       <queryOptions>
        <QueryOptions>
           <IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>
           <ViewAttributes Scope="RecursiveAll"/>
           <DateInUtc>TRUE</DateInUtc>
        </QueryOptions>
      </queryOptions>
      </soap1:GetListItems>
   </soap:Body>
</soap:Envelope>

关于如何从结果中包含的folder1,folder3和sub-folder1中获取文件的任何线索?
如果Lists Web服务无法执行此操作,是否有替代服务/方法?

附加信息:
还有另一个Web服务SiteData (_vti_bin/sitedata.asmx)。它有一个类似的方法(getListItems)并返回仅包含列表名称且没有其他参数的所有文件。问题是我无法弄清楚如何/在何处指定Paging参数,因为像Lists一样没有queryOptions输入元素网络服务。
 <soap1:strListName>?</soap1:strListName>
 <soap1:strQuery>?</soap1:strQuery>
 <soap1:strViewFields>?</soap1:strViewFields>
 <soap1:uRowLimit>?</soap1:uRowLimit>

最佳答案

使用<ViewAttributes Scope="RecursiveAll"/> elment可以递归获取列表内容。
我的肥皂信封中出现silly错误。 queryOptions元素没有 namespace 。我修正了以下文字。

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
   <soap:Header/>
   <soap:Body>
      <soap1:GetListItems>
         <soap1:listName>Shared Documents</soap1:listName>
       <**soap1:**queryOptions>
        <QueryOptions>
           <IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>
           <ViewAttributes Scope="RecursiveAll"/>
           <DateInUtc>TRUE</DateInUtc>
        </QueryOptions>
      </**soap1:**queryOptions>
      </soap1:GetListItems>
   </soap:Body>
</soap:Envelope>

顺便说一句,有一个很棒的工具U2U CAML Builder来构建SharePoint CAML。我希望我能在几周前找到它。

关于web-services - SharePoint List.getListItems Web服务以递归方式返回子文件夹的内容,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6351845/

10-12 17:44
查看更多