I am using below api to get files in descending order of modified date, but it not working.

url = _spPageContextInfo.webServerRelativeUrl + "/_api/Web/GetFolderByServerRelativeUrl('EmployeeDocumentList/703079322')?$expand=Files/ListItemAllFields&$orderby=TimeLastModified desc";

Is there anything that I am missing over here?

  • do you mean ascending order or descending ? If you want ascending order, just remove the desc at the end – Gautam Sheth Dec 8 '17 at 7:50
  • I have updated the question, I need it in descending order – KumarV Dec 8 '17 at 7:52

Internal name for Modified Item Date is Modified.

Hence, your query should be:

url = _spPageContextInfo.webServerRelativeUrl + "/_api/Web/GetFolderByServerRelativeUrl('EmployeeDocumentList/703079322')?$expand=Files/ListItemAllFields&$orderby=Modified desc";

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.