Skip to main content

Notifications

Community site session details

Community site session details

Session Id : w+XtYL7Kd0P63f+xpX/pXr
Power Automate - Building Flows
Answered

Count unread inbox emails

Like (0) ShareShare
ReportReport
Posted on 18 Nov 2023 00:40:39 by 30

Hello, I am new in Automate and I have a task: create a flow that each day at 9 am send an alert in teams with the number of unread emails in the INBOX folder of an specific email.

 

I have this with the first part indicating the hour, then the email connection and at the end the message in teams, but I do not know how to count the unread emails and add it to the message

eduardosilvin_0-1700268003902.png

 

 

Thanks in advance

  • RA-21101257-0 Profile Picture
    2 on 22 Oct 2024 at 08:00:52
    Count unread inbox emails
    I have shared the bypass for the count limit as @creativeopinion descriped with my developers and the answer was that this would require a license per user of the app. An expensive solution
     
    Is there a workaround for that?
     
    Thanks and regards
     
    Ron
  • eduardosilvin Profile Picture
    30 on 19 Nov 2023 at 08:21:03
    Re: Count unread inbox emails

    Thanks Victor, 100% right! for other users the flow is like this (working ok): 

    eduardosilvin_0-1700382047079.png

     

    Regards

     

  • eduardosilvin Profile Picture
    30 on 19 Nov 2023 at 07:59:41
    Re: Count unread inbox emails

    Hello Victor, sorry I did not see your response, I found your zip a few hours ago but I did not know what to add in one of the 2 connections that required and I did not continue trying, I will try to change what you said in you latest response to see if it works! thanks!

  • VictorIvanidze Profile Picture
    12,212 on 19 Nov 2023 at 07:46:46
    Re: Count unread inbox emails

    Hi @creativeopinion,

    very informative, but don't you think the "Parse JSON" action is useless here?

    You can simplify the flow a bit just using  

    length(body('Send_an_HTTP_request')?['value'])

     

  • eduardosilvin Profile Picture
    30 on 19 Nov 2023 at 07:08:42
    Re: Count unread inbox emails

    AWESOME, thank you because you explained it so well, you are the best! regards!

  • creativeopinion Profile Picture
    10,396 Super User 2025 Season 1 on 19 Nov 2023 at 00:21:42
    Re: Count unread inbox emails

    @eduardosilvin Sorry if the mis-communication. I have updated my original post for clarification.

     

  • eduardosilvin Profile Picture
    30 on 18 Nov 2023 at 22:57:11
    Re: Count unread inbox emails

    Thank you so much, is a great explanation, just one more doubt, where should I add the HTTP request? after the compose of "get email count"?

  • VictorIvanidze Profile Picture
    12,212 on 18 Nov 2023 at 18:14:06
    Re: Count unread inbox emails

    Modify this flow: https://ivasoft.com/countemailsflow.shtml

  • Verified answer
    creativeopinion Profile Picture
    10,396 Super User 2025 Season 1 on 18 Nov 2023 at 04:15:16
    Re: Count unread inbox emails

    @eduardosilvin You'll need to switch to the Classic Designer to follow along. Click the three dots (top right of the screen) and select Switch to classic designer.

    creativeopinion_5-1700279472527.png

     

     

    Get Emails (V3) Limitations

    It's important to note that the Get emails (V3) action has a limit of 25 emails that it'll return. The default is 10. I'll explain how to bypass this limit below.

     

    creativeopinion_3-1700279341275.png

     

    Get Email Count

    To return a count of items you need to use an expression. Add a Compose action to store the expression. Click on the Expression tab and insert the length() function.

    length()

    creativeopinion_1-1700279244796.png

     

    With your cursor in between the brackets, select the Dynamic Content tab. Insert the value dynamic content from the Get Emails (V3) action.

    creativeopinion_2-1700279281179.png

     

    Run a test. The number of unread emails will be stored in the Compose action. 

    creativeopinion_4-1700279365427.png

     

    Send an HTTP Request (Outlook)

    You can bypass the 25 email limit by using a Send an HTTP Request action instead. Insert the text below into the URI field. Customize the top count number to suit your requirements.

     

    https://graph.microsoft.com/v1.0/me/messages?$filter=isRead eq false&top=100

    creativeopinion_7-1700280546232.png

    Run a test. Copy the outputs to your clipboard. Tip: Place your cursor in the outputs and press CTRL + A or CMD + A to select all. 

    creativeopinion_8-1700280577197.png

    Add a Parse JSON action. In the Content field insert the body dynamic content from the Send an HTTP Request action. 

     

    Press the Generate from Sample button.

    creativeopinion_10-1700280601486.png

     

    Paste the content from your clipboard and press Done.

    creativeopinion_11-1700280612168.png

    In a Compose action use the length() function (refer to instructions above) and insert the value dynamic content from the Parse JSON action. 

    creativeopinion_12-1700280647881.png

     

    Run a test. Verify the outputs. 

    creativeopinion_13-1700280674746.png

     

    Add Count to Teams Post

    In your Post message in a chat or channel action, insert the Outputs from the Compose action that is storing the number of unread emails into the Message box.

    creativeopinion_14-1700280897398.png

     

    For clarification: 

    If you are using the Send an HTTP request action, your flow should look like this

    creativeopinion_1-1700353228479.png

     

    If you are not using the Send an HTTP request action, your flow will look like this

    creativeopinion_2-1700353256962.png

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉Watch my tutorials on YouTube
    👉Tips and Tricks on TikTok

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard