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?

2 Answers 2


You 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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