rest - Office365 Outlook REST API 不返回所有邮件

标签 rest powershell outlook office365 outlook-restapi

我正在使用 Office365 并尝试使用以下 Powershell 命令获取邮件文件夹中的邮件计数:

( Invoke-RestMethod -Method get -Uri ("https://outlook.office365.com/api/beta/me//Messages/") -Credential $UserCredential ).Count

我使用的邮箱总共有 598 条消息,但上面的命令只会返回 10 条

如果我采取另一种方法并使用以下命令,我将收到 266 条消息:

Invoke-RestMethod -Method get -Uri ("https://outlook.office365.com/api/beta/me//Messages/`$count") -Credential $UserCredential

有没有办法使用 REST API 在 Office365 中递归获取所有消息,如果是这样,我做错了什么?

亲切的问候

尤里

最佳答案

API me/messages不会一次性返回所有消息,默认长度为10。

要获取所有消息,您可以使用 $top and $skip .

例如:me/Messages?$top=20 将获取前 20 条消息,me/Messages?$skip=20&$top=20 将获取接下来 20 条消息。

关于rest - Office365 Outlook REST API 不返回所有邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36143103/

相关文章:

php - Paypal REST API : Get Subclass, 例如销售,来自 PayPalModel Superclass

powershell - 我想使用 testcafe 创建我的第一个测试,但出现如下错误

c# - 使用 C# 或 Powershell 扫描所有可用的无线网络并连接到特定的 SSID

html - 避免在电子邮件回复中删除图像

vba - 如何使用 VBA 将新项目添加到 Outlook 2007 中的超链接菜单?

php - 如何将 drupal 事件日历与 Outlook 日历同步

rest - channel :mychannel received discovery error:access denied Failed to evaluate transaction: Error: DiscoveryService: mychannel error: access denied

ruby - 通过 ruby​​ 脚本设计身份验证

web-services - RestTemplate 返回类型

PowerShell 标准输出和重定向