title: ViewAttributes Recursive Scope not working SharePoint 2013 CAML Query to fetch all files from document library recursively
body: <p>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.</p>
  
  <p>Using SP 2010 U2U CAML Builder, I have made below query: </p>
  
  <pre><code>&lt;query&gt;
  &lt;QueryOptions&gt;
          &lt;ViewAttributes Scope="Recursive" /&gt;
      &lt;/QueryOptions&gt; 
  &lt;/query&gt;
  </code></pre>
  
  <p>This query is working fine with libraries in SP 2010, but it is not working with SP 2013</p>
  
  <p>Below is the code for fetching data from SP 2013 library</p>
  
  <pre><code>CAMLQuery = "&lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'&gt;\
    &lt;soapenv:Body&gt;\
      &lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt;\
        &lt;listName&gt;My Document Library&lt;/listName&gt;\
  &lt;query&gt;\
  &lt;QueryOptions&gt;\
          &lt;ViewAttributes Scope="Recursive" /&gt;\
      &lt;/QueryOptions&gt; \
  &lt;/query&gt;\
      &lt;/GetListItems&gt;\
    &lt;/soapenv:Body&gt;\
  &lt;/soapenv:Envelope&gt;";
  
  $.ajax({
      url: "https://&lt;server&gt;/teams/&lt;siteName&gt;/_vti_bin/lists.asmx",
      type: "POST",
      dataType: "xml",
      data: CAMLQuery,
      complete: getGrid,
      contentType: "text/xml; charset=\"utf-8\""
  });
  </code></pre>
  
  <p>getGrid is callback function on completion</p>
  
  <p>Please help me with this.</p>