Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
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:

<pre lang="xml">
<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.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900