[英]Office365 Outlook REST API Does Not Return All Messages
I am using Office365 and trying to get message count in Mail Folders with the following Powershell command: 我正在使用Office365,并尝试使用以下Powershell命令获取“邮件文件夹”中的邮件计数:
( Invoke-RestMethod -Method get -Uri ("https://outlook.office365.com/api/beta/me//Messages/") -Credential $UserCredential ).Count
Mailbox I am using has 598 messages total however the command above will return only 10 我正在使用的邮箱共有598条消息,但是以上命令仅返回10条消息
If I take another approach and use the following command I would get 266 messages: 如果我采用另一种方法并使用以下命令,则会收到266条消息:
Invoke-RestMethod -Method get -Uri ("https://outlook.office365.com/api/beta/me//Messages/`$count") -Credential $UserCredential
Is there any way to get all the messages recursively in Office365 using REST API and if so, what I am doing wrong? 有没有办法使用REST API在Office365中以递归方式获取所有消息,如果是,我在做什么错?
Kind regards 亲切的问候
Yuriy 尤里
API me/messages
will not return all the messages at one time, the default length is 10. API me/messages
不会一次返回所有消息,默认长度为10。
To get all the messages, you can use $top and $skip . 要获取所有消息,可以使用$ top和$ skip 。
For example: me/Messages?$top=20
will get the top 20 messages, me/Messages?$skip=20&$top=20
will get the next 20 messages. 例如: me/Messages?$top=20
将获得前20条消息, me/Messages?$skip=20&$top=20
将获得后20条消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.