web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Daily count of emails ...
Power Automate
Unanswered

Daily count of emails in shared mailbox folder

(1) ShareShare
ReportReport
Posted on by 271

Hi all,

 

I am trying to achieve an automated count of emails in a shared mailbox folder at the end of each day, but ignoring what date the email was received as they could be from previous dates.

 

I had been trying to achieve this by adding a row to a list when they are added to the folder, but discovered that emails with a date prior to the last flow run were not counted as new so that is not an option.

 

Ideally I would like to be able to schedule a flow to run, count what is in the folder (named DONE) and then move all of those emails to another folder.

 

I am absolutely stumped!!

 

any help would be great

Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,073 on at

    Use a single GRAPH request to do what you want.

    Request:

    https://graph.microsoft.com/beta/me/mailfolders/inbox/

     

    Result  (note totalItemCount):

     

    {
     "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('f078e88e-797c-46da-8f4a-c91c832774e2')/mailFolders/$entity",
     "id": "AAMkADVjNzc0NWZmLTRlNjctNDk3YS05OTVmLTk3MDE5NzMwZjRhYwAuAAAAAADyW2DLP5JUSJc_cjIQPjsTAQBrAj4i9HMnQpl_Colj4t7UAAAAAAEMAAA=",
     "displayName": "Inbox",
     "parentFolderId": "AAMkADVjNzc0NWZmLTRlNjctNDk3YS05OTVmLTk3MDE5NzMwZjRhYwAuAAAAAADyW2DLP5JUSJc_cjIQPjsTAQBrAj4i9HMnQpl_Colj4t7UAAAAAAEIAAA=",
     "childFolderCount": 4,
     "unreadItemCount": 0,
     "totalItemCount": 816,
     "wellKnownName": "inbox",
     "isHidden": false
    }

     

     

     

     

     

  • Gwill1983 Profile Picture
    271 on at

    Thanks for the reply!

     

    i have no idea what this means, but will research graph requests and use the code you have given.

     

    much appreciated

  • Verified answer
    v-LilyW-msft Profile Picture
    on at

    Hi @Gwill1983 

    Has your problem been solved?

    You also can take a try to use Get emails action and Move email action and set variables to move all email from one folder to another folder and count the total number of emails in the 'Done' folder.

    I set up a flow, you can refer to the screenshots below.

    vLilyWmsft_0-1637653141944.png

    vLilyWmsft_2-1637653397617.png

    Get emails action cannot directly select the shared mailbox folder,So first we need to get the folder path of 'Done' folder.

    In Compose is the path of the 'Done' folder. How to get the folder path, you can refer to this article.

    https://tomriha.com/how-to-get-emails-from-a-folder-in-a-shared-mailbox-with-power-automate/

    vLilyWmsft_7-1637653832846.png

    vLilyWmsft_3-1637653447910.png

    Expression:

    length(body('Get_emails_(V3)')?['value'])

    vLilyWmsft_4-1637653473420.png

    vLilyWmsft_5-1637653547707.png

    vLilyWmsft_6-1637653583143.png

    After flow runs, the emails in 'Done' folder will be moved to 'Archieve-1' folder and the number of emails will be recorded in excel.

    vLilyWmsft_11-1637654769567.png

     

    vLilyWmsft_9-1637653937864.png

    Hope the content above may help you.

    Best Regards

    If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Gwill1983 Profile Picture
    271 on at

    This looks amazing! Thanks

     

    I will try to set this up later and let you know if it has solved all of my problems! 

  • VictorIvanidze Profile Picture
    13,073 on at

    Hi @v-LilyW-msft,

     

    how long will run your flow if you have 1000 items in the folder - did you test it?  

  • Gwill1983 Profile Picture
    271 on at

    Hi.

     

    not tested yet. I plan to do it today. 
    my flow will need to be duplicated as I have 2 sub folders that need to be counted along with an overall incoming email count withon the same flow.

    I will update you on how long this takes later. My count is only likely to be approx 300 emails per day 

  • Gwill1983 Profile Picture
    271 on at

    So.... I have tested this and it doesn't appear to work. This section is completely greyed out when my flow is tested

     

    Gwill1983_0-1637758427749.png

    (This is the moving emails section just before adding the row to the spreadsheet)

     

    I don't think it is finding the email folder so doesnt attempt to move anything.

     

    Any ideas?

     

     

  • Gwill1983 Profile Picture
    271 on at

    Hi. 

     

    I was making a rookie mistake and only trying to move unread emails (which is why none were moving!!)

     

    This works absolutely perfectly. Thanks so much for your help

  • Mark74 Profile Picture
    2 on at

    Hello, I can't find the solution to the issue I'm facing, and hope someone can help me with this.

    Purpose flow: 
    The purpose of the flow is to count the number of emails (read & unread) in a shared Outlook mailbox folder and sent an email with the day and number of emails of that day.

     

    Built flow:

    The result of my built flow is that all emails are forwarded instead of 1 email with the number of emails of that day.

    See also the attached photos of my flow.

     

    Issues:

    1. One email instead of all the emails

    2. Count the emails of that day

    3. Add to Subject (or body) the date of counting and the number of counted emails.

     

    I hope someone can help me with this. Thank you!
    @Gwill1983 ; @VictorIvanidze 


    1.1.2.2.3.3.

  • Gwill1983 Profile Picture
    271 on at

    Hi. 

    My email count is currently working by adding all of the various counts to a spreadsheet and then constructing my daily email from the entries within the spreadsheet. It is counting emails from 2 sub folders and an overall daily incoming email count.

     

    I have compared my flow to yours and it looks as though yours is missing the 'do until' step as below:

     

    Gwill1983_0-1651674001525.png

    Gwill1983_1-1651674056322.png

    It is this final 'increment variable' named 'Count' that I reference in my email.

     

    Hopefully this helps

     

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard