I have a document library SP 2013 and want to get all the documents from all folders and sub folders. I don't want any folders but I do want to get all the files from each folder.
Using SP 2010 U2U CAML Builder, I have made below query:
<query>
<QueryOptions>
<ViewAttributes Scope="Recursive" />
</QueryOptions>
</query>
This query is working fine with libraries in SP 2010, but it is not working with SP 2013
Below is the code for fetching data from SP 2013 library
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 is callback function on completion
Please help me with this.
you have to give the scope in the view-tag, like this:
<View Scope="RecursiveAll">
<Query>
<Where>...</Where>
</Query>
</View>