I am using Office365 and trying to get message count in Mail Folders with the following Powershell command:
( 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
If I take another approach and use the following command I would get 266 messages:
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?
Kind regards
Yuriy
API me/messages
will not return all the messages at one time, the default length is 10.
To get all the messages, you can use $top and $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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.