Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Triggers
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
  • Get help with flow
Menu

How to get more than 25 emails from a mailbox with Power Automate

Posted on April 13, 2022April 13, 2022 by Tom

“Is there a way to overcome the limit of 25 emails that are returned by the ‘Get emails (V3)’ Power Automate action?”


If you extract emails with the ‘Get emails’ action, you’ll notice the ‘Top’ field. This field defines how many emails it’ll retrieve, and the maximum is 25 emails. The action doesn’t allow you to define any higher number, you’ll get 25 emails and that’s it.

power automate 25 emails

But that’s a small limit considering how many emails some people send and receive daily. There can be a hundred, or multiple hundreds of emails waiting for processing.

How do you get all those emails?

Get the emails directly via Graph API

While the ‘Get emails’ action is limited, there’s another way how to get emails from your mailbox – via the Microsoft Graph API. You can imagine it as the ultimate interface to communicate with the Microsoft 365 platform, and although it can get quite complicated for some operations, extracting emails is easy.

The action you’re looking for is the Office 365 Groups action ‘Send an HTTP request’.

This action allows you to send some requests to Graph API, and retrieving emails is one of them.

Get emails from top level folder

To get emails from the top level folder you can reference it by the folder name, e.g. Inbox or SentItems.

https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages

Such HTTP request will give you the emails in the folder including all their data. Which can be a bit more information than you need and it can take a while before it loads everything. Adding the $select parameter will reduce each email information only to some properties, e.g. the sender and the subject in addition to the default email id.

https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$select=sender,subject

The last parameter to add is the number of emails. By default it’ll return 10 emails as the ‘Get emails’, but you can add the ‘top’ parameter to increase the number, e.g. to 100 emails.

https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$select=sender,subject&top=100

Get emails from subfolders

It gets a bit more complicated with the subfolders. Unlike the top level folders you can’t reference them by their name, you’ll need their ID.

The easiest way to get the folder id is similar to getting id of a folder in a shared mailbox. Add the ‘Get emails’ action, select the folder, and go to ‘Peek code’.

You’ll see the parameter ‘folderPath’ starting with Id:: and following with the folder id.

That’s the ID you need, it might look as below:

AQMkADE3OTNhNGI1LTYyYjctNDY4OS0543210ZDQ1ODcyMDI1OAAuAAADh0B4vZMJRUuk0KeEgj1abcde_HTm2u9F_0iDdSSR05BZTwABHOBFygAAAA==

Take it and use it instead of the folder name in the HTTP request.

https://graph.microsoft.com/v1.0/me/mailFolders('AQMkADE3OTNhNGI1LTYyYjctNDY4OS0543210ZDQ1ODcyMDI1OAAuAAADh0B4vZMJRUuk0KeEgj1abcde_HTm2u9F_0iDdSSR05BZTwABHOBFygAAAA==')/messages?$select=sender,subject&top=100
power automate 25 emails

Using the ID you can reference any folder on any level in your mailbox.

Summary

It’s possible to get more than 25 emails from a mailbox in Power Automate, but not with the default ‘Get emails’ action. The action has a limitation that you can’t bypass, therefore, you must use another approach. And the approach is to ask for the emails via Graph API. Use the Office 365 Groups action ‘Send an HTTP request’, define which folder it should check, and get as many email as you’d like.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

12 thoughts on “How to get more than 25 emails from a mailbox with Power Automate”

  1. Tran Dac Huy says:
    April 19, 2022 at 6:53 am

    Could you show me the way to get many value is modified in sharepoint and summarized them and send all of new value update to mail outlook in once time.

    Reply
    1. Tom says:
      April 23, 2022 at 8:27 pm

      Hello Tran Dac Huy,
      I’m sorry but I don’t see how it’s related to the article.

      Reply
  2. Matt says:
    June 7, 2022 at 7:29 pm

    Hi Tom,
    how would you add a filter on the email Subject, e.g. “Order#”, extract those emails with that text in the Subject, and then write the Subject and the email date into a excel table?

    Reply
    1. Tom says:
      June 12, 2022 at 8:43 pm

      Hello Matt,
      set the subject filter in the trigger action (https://tomriha.com/search-for-multiple-words-in-the-incoming-email-subject-power-automate/) and then just add a new row in the Excel file.

      Reply
  3. Mark says:
    June 26, 2022 at 10:38 am

    Hi Tom, rather than retrieve my emails I would like to retrieve emails sent to my team in a shared mailbox.

    I guess I would change the reference to ‘me’ in the URL https://graph.microsoft.com/v1.0/me/.

    Could I used this method to identify a different mailbox?

    Reply
    1. Tom says:
      July 6, 2022 at 6:43 pm

      Hello Mark,
      you should be able to access shared mailbox using the call below:
      https://graph.microsoft.com/v1.0/users/{sharedmailboxmailaddress}/messages
      source: https://docs.microsoft.com/en-us/answers/questions/80006/shared-mailbox-handling-with-microsoft-graph.html

      Reply
  4. Jann says:
    August 4, 2022 at 11:29 am

    great posting. But i´m having trouble when submitting the “send an http request”. I have a flow where it gets 25 mails untill now 😉 but after “send an http request” i have the “apply to each” where it should forward an mail if it is less than or equal to -5 days. here it seems my flow breaks when their is more than 25 emails in the subfolder, used the Get-email. The above seems to break the flow preferably because it should select an output and suggests “body” but if i chose this i wont be able to forward the mail with its attachment, guessing here. Can´t seem to figure out which 1 to choose here

    Reply
    1. Tom says:
      August 14, 2022 at 5:17 pm

      Hello Jann,
      it’ll offer only the body as the dynamic content, but you can extract any information about the email directly from the output JSON as described here: https://tomriha.com/how-to-get-a-specific-value-from-a-json-object-in-power-automate/. I guess you’ll need the email id to forward the email.

      Reply
  5. Nasser says:
    October 27, 2022 at 10:31 pm

    Hello Tom,

    Thank you for this post.

    I have a question, which parameter does includes attachement ? (Like with get emails trigger)

    Thank you for your help

    Reply
  6. Nasser says:
    October 27, 2022 at 11:42 pm

    Hello Tom,

    I finally succeeded to get all the attachements from my mails by using a second http request in an apply to each loop.

    https://graph.microsoft.com/v1.0/me/mailFolders('@{variables(‘ID’)}=’)/messages(‘@{items(‘Apply_to_each’)?[‘ID’]}’)/attachments?

    Have a good week-end.

    Reply
    1. Tom says:
      November 6, 2022 at 8:11 pm

      Hello Nasser,
      thank you for sharing the solution.

      Reply
  7. Horea says:
    January 27, 2023 at 1:12 am

    Hi Tom,
    Thanks for the valuable insight. However, I don’t understand how do I make the flow to repeat the request. I thought I don’t have to put a ‘get emails’ command in the flow. If I only put an Add Row into a tabel, it only yields one email. How do I make them loop? I guess the subject, body and other fields of interest have to be brought in via some JSON commands?

    Thanks in advance for any help!

    Reply

Leave a Reply Cancel reply

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

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


NEW! Master the HTTP requests to SharePoint with a new cheat sheet!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Use Power Automate to forward Outlook events upon registrationJanuary 29, 2023
  • Why the condition is false for the same numbers (Power Automate)January 25, 2023
  • How to forward event invitation to other calendar (Power Automate)January 22, 2023
  • Run ‘For selected item’ flow from non-default environment (Power Automate)January 18, 2023
  • Hide button in SharePoint list after Power Automate flow startedJanuary 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes