Bypassing Outlook's 25-Email Limit with Power Automate
The standard 'Get Emails (V3)' action limits you to 25 items. Use the 'Send an HTTP request' action with the Microsoft Graph API to fetch hundreds of emails efficiently.
When building Power Automate flows that process emails, the Get Emails (V3) action is a natural starting point. While suitable for simple triggers, it imposes a hard limit of 25 items per run, rendering it useless for bulk processing, data migration, or comprehensive mailbox auditing.
The workaround involves calling the Microsoft Graph API directly using the built-in Send an HTTP request action from the Office 365 Outlook connector. This technique completely bypasses the 25-item ceiling and hands you full control over your mailbox queries.
This article provides a fully original walkthrough of this approach, covering a fresh business scenario, critical JSON parsing steps, paginated results, and the most common pitfalls you will encounter.
An Original Scenario: The 'Project Phoenix' Invoice Processor
Consider a shared mailbox invoicing@phoenix-corp.com that receives hundreds of vendor invoices daily. We need a scheduled Power Automate flow that runs every hour, fetches all unread invoices, and archives their PDF attachments to a SharePoint document library named ProcessedInvoices.
The standard Get Emails (V3) action would only capture the first 25 messages, missing the vast majority of daily invoices. The Send an HTTP request action is the correct solution here.
Step 1: The Core Graph API Query
Add a Send an HTTP request action and configure it as follows:
- Method:
GET - URI: The Graph API endpoint for the target mailbox.
If the flow uses a connection to a shared mailbox, use the /users/{mailbox-address}/ route. If it targets the connected user's primary mailbox, use the /me/ route.
Shared Mailbox Query:
https://graph.microsoft.com/v1.0/users/invoicing@phoenix-corp.com/messages?$top=500&$filter=isRead eq false&$orderby=receivedDateTime desc
Personal Mailbox Query (flow owner's inbox):
https://graph.microsoft.com/v1.0/me/messages?$top=500&$filter=isRead eq false&$orderby=receivedDateTime desc
The $top parameter defines the maximum number of emails to retrieve (up to 1000). The $filter ensures we only pull unread items, and $orderby sorts them from newest to oldest.
Step 2: Parsing the JSON Response
Unlike the standard action, the HTTP request returns raw JSON. Power Automate cannot automatically surface the email fields as dynamic content unless you parse this JSON.
Add a Parse JSON action immediately after the HTTP request.
- Content:
Bodyfrom the Send an HTTP request action. - Schema: Generate it using a sample payload. You can quickly obtain a sample by running a similar query in the Microsoft Graph Explorer and copying the response body into the schema generator.
Once parsed, you will have dynamic content tokens for properties like subject, hasAttachments, and id.
Step 3: Iterating Over the Emails
Add an Apply to each action. The input is the value array from the parsed JSON.
body('Parse_JSON')?['value']Inside this loop, we can process every email. For our target scenario, we must:
- Check if the email has any attachments.
- If it does, fetch the attachment data via another API call.
- Create the corresponding files in the
ProcessedInvoicesSharePoint library.
Step 4: Fetching Attachments Efficiently
The initial /messages query does not return the file bytes for attachments. You must make a secondary request for each message that has them.
Place a Condition action inside the Apply to each loop. Check whether the hasAttachments field equals true.
In the If yes branch, add another Send an HTTP request action to retrieve the attachments for that specific message.
- Method:
GET - URI:
https://graph.microsoft.com/v1.0/users/invoicing@phoenix-corp.com/messages/@{items('Apply_to_each')?['id']}/attachmentsThe response will contain an array of attachments. You will likely need a nested Parse JSON and another Apply to each to handle each file. Pay special attention to the contentBytes property. Files over 3 MB may require using the microsoft.graph.uploadSession endpoint instead of a direct GET request.
Common Mistakes and Troubleshooting
- 401 Unauthorized Error: The flow account lacks sufficient permissions on the target mailbox. Grant the flow owner at least Full Access or Mail.Read permissions for that mailbox.
- Missing Parse JSON Action: Without parsing the raw output, you cannot easily select dynamic content like
hasAttachmentsorsubject. This is the most frequent oversight when following tutorials that omit this step. - Pagination Handshake: The
valuearray only contains the items in the current page. If your query exceeds the$toplimit, the response includes an@odata.nextLinkproperty. You must implement a Do until loop to follow this link and fetch the remaining pages. - Throttling (HTTP 429): Sending sequential requests for every attachment in every email can exhaust your API limits. Set the Concurrency Control in your Apply to each actions to a low number (like 1) to slow the request rate, or implement a custom retry policy.
- License Considerations: The Send an HTTP request action is part of the standard Office 365 Outlook connector, but heavily nested loops and high-frequency polling may require a premium Power Automate license to avoid performance throttling.
Final Recommendation
The Send an HTTP request action is the definitive solution for bypassing the 25-email limit in Power Automate. While the standard Get Emails (V3) action is fine for simple triggers or very small batches, any serious mailbox processing demands the flexibility and power of the Microsoft Graph API.
My recommendation is to standardize on this pattern. Create a reusable Bulk Email Fetcher child flow that encapsulates pagination, JSON parsing, and error handling. This transforms a clever workaround into a maintainable, enterprise-ready building block.
References
- Original Methodology: Matthew Devaney, "How To Get Over 25 Emails In Power Automate", https://www.matthewdevaney.com/how-to-get-over-25-emails-in-power-automate/
- Microsoft Graph API Documentation: List messages, Official Microsoft Learn
- Microsoft Graph API Documentation: List attachments, Official Microsoft Learn
Core principles for resilient, maintainable, and efficient cloud flows, distilled from real-world implementations.
Build flows that gracefully handle failures and automatically notify you with run details.
Discover the trade-offs between Content-ID, Base64, and the Microsoft Graph API for embedding images in Power Automate emails. This guide covers which method works best for Outlook, Gmail, and more.