Get Document Library MetaData And File Path (Both) USing Rest API Sharepoint 2013
function getToolLibrayAllReords(callback) {
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('ToolsLibrary')/" + "GetItems(query=@v1)?" + "$expand=ListItemAllFields,File&@v1={\"FolderServerRelativeUrl\" : \"/Sites/EMS/ToolsLibrary\", \"ViewXml\":\"" + "<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='IsRecommended' /><Value Type='Boolean'>1</Value></Eq></Where><OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy></Query></View>\"}",
type: "POST",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"content-Type": "application/json;odata=verbose"
},
success: function(data) {
callback(data);
},
error: function(error) {
alert(JSON.stringify(error));
}
});
}
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('ToolsLibrary')/" + "GetItems(query=@v1)?" + "$expand=ListItemAllFields,File&@v1={\"FolderServerRelativeUrl\" : \"/Sites/EMS/ToolsLibrary\", \"ViewXml\":\"" + "<View Scope='RecursiveAll'><Query><Where><Eq><FieldRef Name='IsRecommended' /><Value Type='Boolean'>1</Value></Eq></Where><OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy></Query></View>\"}",
type: "POST",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"content-Type": "application/json;odata=verbose"
},
success: function(data) {
callback(data);
},
error: function(error) {
alert(JSON.stringify(error));
}
});
}
Comments