How to get filename from Sharepoint resource library
How do I get the filename of an image from a SharePoint 2013 asset library?
I am trying to write a JQuery / REST snippet to find a subset of images in a library based on their other column values ββand display them. I would use FileLeafRef
in the case of a document library, but couldn't find an equivalent field in the Object Library.
I have tried the following so far, and it is not returning the filename: https: /// CRM / _api / Web / Lists / GetByTitle ('Publish% 20List') / select items = Filename / & extension = File? https: /// CRM / _api / Web / Lists / GetByTitle ('Publish% 20List') / select items = FileLeafRef
?source to share
There is a typo in your example, in particular the symbol is $
missing for parameters $select
and $expand
( more ).
The following rest endpoints demonstrate how to get the filename from the Assets library:
1) Using the property FileLeafRef
:
/_api/web/lists/getByTitle('<list title>')/items?$select=FileLeafRef
2) Using the property File/Name
:
/_api/web/lists/getbytitle('<list title>')/items?$select=File/Name&$expand=File
3) Using the property Folder/Files
:
/_api/web/getfolderbyserverrelativeurl('<list url>')/files?$select=Name
source to share
I believe yt is still FileLeafRef
for asset library. Is there any chance you could put the relevant code in your question?
Here's the endpoint breakpoint for FileLeafRef
:
/_api/web/lists/getByTitle('<list title>')/items?$select=FileLeafRef
Alternatively, you can always use the property File Name
:
/_api/web/lists/getByTitle('<list title>')/items?$select=File/Name&$expand=File
source to share