Odata Office 365图形API-在接收日期大于筛选器

Odata Office 365图形API-在接收日期大于筛选器,odata,office365api,microsoft-graph-api,Odata,Office365api,Microsoft Graph Api,我试图在Office 365 Graph API上执行一个查询,说“在{someISODateTimeString}之前给我所有电子邮件” 例如: https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime gt 2016-02-26T14:41:08Z https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime ge 2016-02-

我试图在Office 365 Graph API上执行一个查询,说“在{someISODateTimeString}之前给我所有电子邮件”

例如:

https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime gt 2016-02-26T14:41:08Z
https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime ge 2016-02-26T14:41:09Z
似乎gt(大于)实际操作等于或大于(ge),因为上面的查询返回一封电子邮件,其中包含我传递到查询中的确切receivedDateTime值

所以我尝试了一种解决方法:

https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime ne 2016-02-26T14:41:08Z AND receivedDateTime ge 2016-02-26T14:41:08Z
这也未能省略接收日期为2016-02-26T14:41:08Z的电子邮件


任何关于如何在接收日期实现“大于”查询的帮助都将不胜感激。

您看到的行为实际上是由于REST API中的精度损失。实际上,大多数日期字段(包括receivedDateTime)的存储精度都高于秒。当前发生的情况是,您的请求被转换为一个查询,其中receivedDateTime>14:41:08.0000。在14:41:08.01出现的消息在技术上比这更大,尽管精确性被删掉,使其看起来相等

您可以使用的解决方法(我们内部也希望在所有“gt”或“lt”方案中使用)是在下一个单元中使用“ge”,因此在您的示例中:

https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime gt 2016-02-26T14:41:08Z
https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime ge 2016-02-26T14:41:09Z

啊,这是有道理的,谢谢你的回答和解决办法!