Reputation: 2514
I am trying to order documents by lastModifiedDateTime
in Graph API.
But it says The property Modified is not supported for OrderBy.
.
I use the following API since I need to use folder-id
.
https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{folder-id}/children?orderby=lastModifiedDateTime desc
.
https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{folder-id}/children?orderby=lastModifiedBy/user/displayName desc
.
But they didn't work at all.
Please let me know the correct use of Graph API.
Thank you.
Upvotes: 0
Views: 1676
Reputation: 16458
Please see this document: Sorting collections:
Note that in OneDrive for Business and SharePoint Server 2016, the orderby query string only works with name and url.
Sharepoint online is actually OneDrive for Business.
So filtering by lastModifiedDateTime
is not supported in this case. It is supported for OneDrive Personal.
You need to get the result first and then sort it in your code. For C# you can look into this answer.
Upvotes: 2