I am trying to retrieve a list of documents in our document library using the API. I do a GET call to https://mysite.sharepoint.com/sites/RapidMachiningSolutionsLLC/_api/Web/Lists/getbytitle('myDocLibrary')/items, but the data that I receive is only for the .doc files in the library.

2 Answers 2


There are multiple ways to retrieve files from the Document library.

Using the REST API you have used, we need to add select and expand in the query as below.


Another approach is to use GetFolderByServerRelativeUrl method to get all the files.


Make sure you are using the INTERNAL NAME of your document library.

  • The first query you showed still does not include .docx or .xlsx files. I haven't been able to get GetFolderByServerRelativeUrl to work.
    – MattWolc24
    Jul 5, 2022 at 16:05
  • what error you are getting? Jul 6, 2022 at 13:47

You can expand files and folders by following rest api


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.