Skip to content

Instantly share code, notes, and snippets.

@davehax
Created October 14, 2016 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davehax/0e3f2cff3ab041388d6775e41eda1709 to your computer and use it in GitHub Desktop.
Save davehax/0e3f2cff3ab041388d6775e41eda1709 to your computer and use it in GitHub Desktop.
var camlQuery = '<View Scope="RecursiveAll"><RowLimit>3</RowLimit><Query><Where><Eq><FieldRef Name="FSObjType" /><Value Type="Integer">0</Value></Eq></Where></Query></View>'
return $.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('Documents')/GetItems?$select=ID,Title,EncodedAbsUrl,File/Name&$expand=File",
type: "POST",
contentType: "application/json; odata=verbose",
headers: {
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"Accept": "application/json; odata=verbose"
},
data: JSON.stringify({
query: {
__metadata: {
type: "SP.CamlQuery"
},
ViewXml: camlQuery,
FolderServerRelativeUrl: '/some/folder/in/there'
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment