Sastrija
Sastrija

Reputation: 3384

Azure Graph API - Include total email count in get messages service call

I'm able to retrieve the first 25 emails from a specific email inbox using below Graph API url.

https://graph.microsoft.com/v1.0/users/<EMAIL_ADDRESS>/mailFolders/inbox/messages/?$skip=0&top=25&count=true

As per Azure Graph API documentation, we can include total email message count in given folder(e.g., Inbox) by including count=true flag.

The count returned in response is inaccurate and sometimes it returns negative values. What is the correct way to get total count along with the response?

Upvotes: 1

Views: 4777

Answers (3)

Omzig
Omzig

Reputation: 921

Here is the stackoverflow answer you are looking for.

This will return all the folders with their TotalItemCount and unreadItemCount:

GET https://graph.microsoft.com/v1.0/me/mailFolders

Here is the microsoft doc for quick reference.

Upvotes: 0

Wanchai Fuangmali
Wanchai Fuangmali

Reputation: 9

https://learn.microsoft.com/en-us/graph/query-parameters On the beta endpoint, the $ prefix is optional. For example, instead of $filter, you can use filter. On the v1 endpoint, the $ prefix is optional for only a subset of APIs. For simplicity, always include $ if using the v1 endpoint.

Try https://graph.microsoft.com/v1.0/users/EmailAccount/mailFolders/inbox/messages/?$skip=0&top=25&$count=true.

Upvotes: 0

Tony Ju
Tony Ju

Reputation: 15629

Several minutes ago, I got -1 as the value of @odata.count when calling the same api.

However, it works now. You can try it again.

enter image description here

Upvotes: 1

Related Questions