我有一个文档库 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/