Querying over 25 emails in Power Automate

Posted by

I had this question pop up twice this week, so I though I should blog about it. The standard connection in Power Automate might not suffice when dealing with large volumes of data, such as retrieving over 25 emails, due to limitations on the number of items that can be retrieved in a single request or due to performance considerations.

Graph Explorer


The Microsoft Graph Explorer is a web-based tool provided by Microsoft that allows developers and users to interactively explore and test the capabilities of the Microsoft Graph API. The Microsoft Graph API provides access to a wide range of Microsoft 365 services and data, including Azure Active Directory, Outlook, OneDrive, SharePoint, and more.

Graph Explorer Link: Graph Explorer | Try Microsoft Graph APIs – Microsoft Graph

Messages Endpoint

The Microsoft Graph API can come in handy when dealing with large volumes of data, such as retrieving over 25 emails because it provides more flexibility and control over data retrieval compared to the standard connectors available in Power Automate. Here’s how the Graph API can help in such cases:

The messages endpoint in Graph API allows you to implement pagination more flexibly than the standard connectors. You can specify the number of items to retrieve per request and navigate through pages of data using pagination tokens $top and $skip

Endpoint: https://graph.microsoft.com/v1.0/me/messages?$top=100&$skip=20


The $top and $skip query parameters are used in Microsoft Graph API (and many other APIs) to control pagination of results. They are particularly useful when dealing with large datasets, as they allow you to retrieve data in smaller, manageable chunks. Here’s how each of them works:

  1. $top: The $top parameter specifies the maximum number of items to include in the result set. It allows you to limit the number of items returned in a single response. For example, if you set $top=10, the API will return a maximum of 10 items in the response. This is useful for controlling the size of the response payload and improving performance by reducing the amount of data transferred over the network.
  2. $skip: The $skip parameter specifies the number of items to skip before returning the remaining results. It allows you to paginate through large result sets by skipping a certain number of items and fetching the next batch of results. For example, if you set $skip=10, the API will skip the first 10 items and return the next batch of items starting from the 11th item. This is useful for implementing pagination functionality in your application or workflow.

With the Graph API, you can apply more advanced filtering and sorting options to narrow down the results and retrieve only the relevant data. This can help optimize the retrieval process and reduce the amount of data transferred.

The Graph API supports custom queries, allowing you to tailor the request to your specific requirements. You can specify parameters such as date ranges, sender/recipient filters, and keywords to retrieve precisely the emails you need.

Power Automate

You can call the GRAPH API via Power Automate by leveraging the Send an HTTP request action. There are several HTTP actions many of which are premium. The one you should look for is the one under Office 365 Outlook

Complete flow

If you want to retrieve 100 emails, you’ll need to make multiple requests, each fetching 25 emails. To do this, you’ll need to adjust the $skip parameter in subsequent requests to fetch the next batches of emails. For example, you would make four requests with $skip=0, $skip=25, $skip=50, and $skip=75, respectively.

Leave a Reply

Your email address will not be published. Required fields are marked *