function GetAllFoldersofRam()
{
var thisUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('NGO-DCUMENT)/GetItems";
var caml = '<View Scope="Recursive"><Query><ViewFields><FieldRef Name="Name" /></ViewFields> </Query></View>';
$.ajax({
url: thisUrl,
type: "POST",
async: false,
headers: {
"Accept": "application/json; odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"Content-Type": "application/json; odata=verbose"
},
data: JSON.stringify({"query": { "__metadata": { "type": "SP.CamlQuery" }, "ViewXml": caml}}),
success: function (data){
alert(data.d.results.length);
// data.d will yield the required results
},
error: function (data){
console.log("Error in query");
}
});
}
Useful Link:
Useful Link:
https://platinumdogs.me/2009/07/21/querying-document-libraries-or-pulling-teeth-with-caml/
http://www.c-sharpcorner.com/blogs/filter-documents-from-sharepoint-libraries-by-metadata-using-rest-api
No comments:
Post a Comment