Forum Discussion
Sharepoint Rest: Get library url
I managed solve the url thing by creating it manually like this:
hostweburl + '/' + this.Title
But I noted another problem:
In the site I have created 2 libraries "test" and "test2" but in the result, besides this 2 libraries, I am also getting system libraries like "MicroFeed", "appfiles", "appdata", etc.
I there a way to filter this system folder out?
This is how I am sending my request:
url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists?@target='" + hostweburl + "'"
and later I am using this:
$(results).each(function () {
items.push('<li class="element">'
+ '<a target="_parent" href="' + hostweburl + '/' + this.Title + '">' + this.Title + '</a>'
+ '</li>');
});
Any tips??
Americo
- DeletedMay 09, 2018
Can you try below?
/_api/web/lists/getbytitle('Document Library Name')/Items?$select=Title,FileLeafRef,EncodedAbsThumbnailUrl,EncodedAbsUrlThe example above returns information about your file such as the name, full url and the internal “Title”:
For instances where you want to know the “type” of document library it is (example Picture Library vs Document Library), use:
1/_api/web/lists/getbytitle('Document Library Name')/BaseTemplateAlthough some information regarding document libraries require an entirely new endpoint. This includes file paths, subfolders, thumbnails and such.
1/_api/web/GetFolderByServerRelativeUrl('"Folder Name"')/FilesThe above contains an entire new set of information regarding your library.
- Americo PerezMay 11, 2018Iron Contributor
Hi,
Thanks!
There is a little difference with the proposal you posted. I need to get the list of all libraries that is why I am using:
url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists?@target='" + hostweburl + "'"
without pointing to a specific library.
The result I am getting doesn't contains "EncodedAbsUrl" in the respons.
This is the response for one of the libraries:
Best regards
Americo