I have a folder in a document library and that contains subfolders and each subfolder contains files.
I want to retrieve all the files in these subfolders using REST. Any help?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityYou can use an endpoint like this /_api/web/lists/getbytitle('Documents')/items?$expand=File&$select=File&$filter=ContentType ne 'Folder'
It will list all files under the library.
This endpoint solved my problem:
_api/Web/GetFolderByServerRelativeUrl('/Library Name/Folder Name/')?$expand=Folders,Folders/Files
For more information, check this article.