use*_*418 2 recursion caml sharepoint-2013
我有一个文档库SP 2013,想要从所有文件夹和子文件夹中获取所有文档.我不想要任何文件夹,但我想从每个文件夹中获取所有文件.
使用SP 2010 U2U CAML Builder,我做了以下查询:
<query>
<QueryOptions>
<ViewAttributes Scope="Recursive" />
</QueryOptions>
</query>
Run Code Online (Sandbox Code Playgroud)
此查询适用于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\""
});
Run Code Online (Sandbox Code Playgroud)
getGrid是完成时的回调函数
请帮我解决一下这个.
小智 11
你必须在view-tag中给出范围,如下所示:
<View Scope="RecursiveAll">
<Query>
<Where>...</Where>
</Query>
</View>
Run Code Online (Sandbox Code Playgroud)