如何在 Graph API 请求中使用 receivedDateTime?

How to use receivedDateTime in Graph API Request?

我在调用图表 API 时尝试使用 receivedDateTime 过滤器子句,但是当我使用确切的日期时间时,我 运行 遇到了问题。例如,当我尝试 运行ning 这个 API 调用时:

GET https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge '2022-05-23T12:29:00'&$orderby=receivedDateTime%20ASC&$top=100&$skip=0

我收到一个 400 错误请求(具体错误提到“错误的过滤器子句”)。但是当我 运行 这个时它起作用了:

GET https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge 2022-05-23'&$orderby=receivedDateTime%20ASC&$top=100&$skip=0

如果我想在过滤器子句中使用准确的日期时间,我该怎么办,或者这甚至可能吗?

您需要在 ISO 8601 时间格式中附加 Z,其中 Z 表示 零 UTC 偏移量 的时区指示符。 (例如 2022-05-23T11:59:59Z

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=receivedDateTime ge 2022-05-23T11:59:59Z