I am working with O365 SharePoint site where I need to get the name and URL for the document libraries in a site collection. I have made a rest call for it as:
https://site/_api/web/lists and select BaseTemplate = 101.
I have managed to get the name of the document library from below code:
$.ajax({
url: siteUrl + "/_api/web/lists",
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
var tempArray = data.d.results;
$.each(data.d.results, function(index, item){
if(item.BaseTemplate == "101")
{
var tempArray = new Array(2);
tempArray[0]= item.Title;
}
});
},
error: function (data) {
alert(JSON.stringify(error));
}
Now, I need to get the URL of the each document library. When I access the value of
item.__metadata.uri
it gives me a value which is a url that is not accessible otherwise. Please get me out of this problem.