首页 > 解决方案 > Microsoft graph api - Outlook - 仅返回最新邮件

问题描述

Outlook https://graph.microsoft.com/v1.0/me/messages的 microsoft graph api不会返回邮箱中的所有邮件。以及如何在特定时间间隔之间获取邮件。

标签: restoutlookpaginationmicrosoft-graph-api

解决方案


您可以使用$filter子句按日期和时间过滤电子邮件。

按日期

GET https://graph.microsoft.com/v1.0/me/messages?$filter=ReceivedDateTime ge 2021-05-07 and receivedDateTime lt 2021-05-10

按日期和时间

GET https://graph.microsoft.com/v1.0/me/messages?$filter=ReceivedDateTime ge 2021-05-07T08:00:00Z and receivedDateTime lt 2021-05-07T12:00:00Z

推荐阅读