筛选最近的文件 Microsoft Graph API 不起作用

Filtering on recent files Microsoft Graph API not working

我正在尝试使用 this endpoint. While fetching the items themselves works, I am unable to filter on lastModifiedDateTime, which is a property of the API response, as per this link.

为用户获取最近访问的项目

我正在向以下端点发出 GET 请求:

https://graph.microsoft.com/v1.0/me/drive/recent?$filter=lastModifiedDateTime ge 2020-08-25T05:30:00Z

我收到 Microsoft.SharePoint.Client.InvalidClientQueryException 消息,其中包含以下消息:

'The expression "lastModifiedDateTime ge 2020-08-25T05:30:00Z" is not valid.'

请帮忙!

显示的错误是 'The expression "lastModifiedDateTime ge 2020-08-25T05:30:00Z" is not valid',这意味着您在过滤器中给出的表达式不正确。您需要如下所示更正它。

https://graph.microsoft.com/v1.0/me/drive/recent?$filter=lastModifiedDateTime ge '2020-08-25T05:30:00Z'

但是这个调用仍然不起作用,因为这个 属性 不支持过滤器,你最终会 'Invalid filter clause'。

作为解决方法,您可以获取最近的文件并在您这边对其进行过滤,因为大多数属性尚不支持过滤。