I have a document library which may have folders in it. I want to get the most recently uploaded files (say latest 10 files) using REST API, irrespective of which folders they are uploaded to.

I can get the latest files in root folder by using below URL.

http://<SERVER>/_api/web/GetFolderByServerRelativeUrl('/<DOCUMENT LIBRARY>')/files?$select=Name,TimeCreated&$orderby=TimeCreated%20desc

But it does not include any files uploaded to folders in the document library.

How can I achieve this? I am open to using client object model also.

  • My account is blocked so help me Commented Jan 28, 2021 at 13:43

1 Answer 1


You can use the below REST endpoint:

$filter=ContentType eq 'Document'
&$orderby=Created desc&$top=10

This will give you latest 10 uploaded documents along with the document's title, name, absolute url as well as created date. This assumes that you know the list name.

  • you can also specify filter as $filter=ContentType ne 'Folder' which will exclude the folders Commented Nov 15, 2017 at 6:59

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.