首页 > 解决方案 > 如何在 Graph API 中按 lastModifiedDateTime 或 lastModifiedBy 用户 displayName 排序?

问题描述

我正在尝试lastModifiedDateTime在 Graph API 中订购文档。

但它说The property Modified is not supported for OrderBy.

我使用以下 API,因为我需要使用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.

但他们根本没有工作。

请让我知道正确使用 Graph API。

谢谢你。

标签: azuresortingmicrosoft-graph-api

解决方案


请参阅此文档:排序集合

请注意,在 OneDrive for Business 和 SharePoint Server 2016 中,orderby 查询字符串仅适用于nameurl

Sharepoint online 实际上是 OneDrive for Business。

lastModifiedDateTime因此在这种情况下不支持过滤依据。OneDrive 个人版支持它。

您需要先获取结果,然后在代码中对其进行排序。对于 C#,您可以查看此答案


推荐阅读