I have a document Library in which there are a number of different folders. Each folder contain different documents. I need to fetch the name of all the documents in a particular folder. So far I have created the endpoint URL that is:

https:// Sharepointsite/sites/DeveloperSite/_api/web/GetFileByServerRelativeUrl('folderrelativeUrl')/Files

This URL gives me null result even if files are present in the folder. When I remove the folder name from URL and put folderRelativeUrl till document Library, I got the result of all the document and files in that library.

I am using c# REST API in visual studio and I am not sure as how to get the name of the documents.

Can anyone provide some information regarding this?

It will be a great help.


1 Answer 1


Try below endpoints and see which suits best for your use:

1) Using FileLeafRef property:

/_api/web/lists/getByTitle('<library title>')/items?$select=FileLeafRef

2) Using File/Name property:

/_api/web/lists/getbytitle('<library title>')/items?$select=File/Name&$expand=File

3) Using Folder/Files property:


Additional Reference:

Working with folders and files with REST.

  • Hi Ganesh i need list of all documents in a particular folder. I have tried these properties but no success. The first two will provide a particular file and the later one is giving me null response. Jul 12, 2019 at 7:57
  • Sorry, it was my mistake. I got the documents list, passing incorrect library name. Jul 12, 2019 at 8:00
  • Could you please help as, how to save these document names using Rest API Jul 12, 2019 at 8:00
  • Where do you want to save this names? Jul 12, 2019 at 8:08
  • We have a website, hitting this endpoint the list of document should be shown on that portal, only name I need. Jul 12, 2019 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.