recursion - ViewAttributes 递归范围不起作用 SharePoint 2013 CAML 查询以递归方式从文档库中获取所有文件

标签 recursion sharepoint-2013 caml

我有一个文档库 SP 2013,想从所有文件夹和子文件夹中获取所有文档。我不想要任何文件夹,但我确实想要从每个文件夹中获取所有文件。

使用 SP 2010 U2U CAML Builder,我做了以下查询:

<query>
<QueryOptions>
        <ViewAttributes Scope="Recursive" />
    </QueryOptions> 
</query>

此查询适用于 SP 2010 中的库,但不适用于 SP 2013

下面是从SP 2013库中获取数据的代码

CAMLQuery = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>\
  <soapenv:Body>\
    <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>\
      <listName>My Document Library</listName>\
<query>\
<QueryOptions>\
        <ViewAttributes Scope="Recursive" />\
    </QueryOptions> \
</query>\
    </GetListItems>\
  </soapenv:Body>\
</soapenv:Envelope>";

$.ajax({
    url: "https://<server>/teams/<siteName>/_vti_bin/lists.asmx",
    type: "POST",
    dataType: "xml",
    data: CAMLQuery,
    complete: getGrid,
    contentType: "text/xml; charset=\"utf-8\""
});

getGrid 是完成时的回调函数

请帮我解决这个问题。

最佳答案

你必须在 View 标签中给出范围,像这样:

<View Scope="RecursiveAll">
    <Query>
        <Where>...</Where>
    </Query>
</View>

关于recursion - ViewAttributes 递归范围不起作用 SharePoint 2013 CAML 查询以递归方式从文档库中获取所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20997265/

相关文章:

c - 正确划分快速排序数组

c - 正确初始化 C 中的递归结构类型

java - 破解编码面试第五版,9.10

sharepoint - SharePoint 2013 中没有 "Save Site As Template"链接

jquery - 通过 SOAP 查询 SharePoint 列表仅返回 View 的第一页

c# - CAML 查询过滤日期范围内的数据

java - 这个中序遍历算法是如何工作的?

javascript - 如何在 JSOM 中使用 ClientPeoplePicker

powershell - 如何在PowerShell中使用CSOM连接到内部部署SharePoint 2013

javascript - 这个 Camel 条款有什么问题