cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Count number of emails recieved and emails sent

Hi,

 

I am trying to build an automated flow that count the emails that arrives in a shared mailbox, and the emails sent from the same mailbox in order to track the activity.  

 

I tried to build the flow, and in regards to emails arriving I was looking at https://powerusers.microsoft.com/t5/Building-Flows/Count-the-number-of-emails-received-in-a-day-via-...

This gave an error though, and I believe it is because I need to do something about my sharepoint list. 

Excellist.PNG

fail.PNG

Any idea to changes I need to doto get emails recieved flow working and how I can count the emails sent? 

5 REPLIES 5
Highlighted
Super User II
Super User II

Re: Count number of emails recieved and emails sent

Hey @Christian8 

Can you share your FLow configuration (Screen shot) please? and confirm which action is generating the error?

Thanks J

Highlighted
New Member

Re: Count number of emails recieved and emails sent

Hi, 

Thank you for your response.

See below screenshots for flow so far. It is "get item" that fails with the screenshot in the first post. The second part of the problem counting the amount of sent items I am not sure if flow can handle? There is not function called "When a new emails is sent from a shared mailbox"

 flow1.PNG

flow2.PNG

Highlighted
Super User II
Super User II

Re: Count number of emails recieved and emails sent

Hi @Christian8 

You're using the SharePoint 'Get Item' action to retrieve an item from the 'Mail Tracker' list with an ID of 1... so every time the Flow's runs it would always try to obtain that list item which I'm guessing doesn't exist ... hence the 404 error.

Have you verified that the item with an ID of 1 exists in the list?

HTH

Jay

 

Highlighted
New Member

Re: Count number of emails recieved and emails sent

Hi Jay, 

 

I believe you are right, but inserting 1 in a cell does not solve the issue, just causing a new one.

I am new to ms flow, but I would very much like to learn. 

Is there a way (on a daily basis) to count the number of mails arriving at a mailbox, and the number sent from the mailbox using MS flow? 

 

Highlighted
Super User II
Super User II

Re: Count number of emails recieved and emails sent

Hey @Christian8 

You can query the graph to obtain this data, albeit this a slightly more complex approach as you'll need to manage authentication, HTTP request / response, etc. - see https://docs.microsoft.com/en-us/graph/api/reportroot-getemailactivityusercounts?view=graph-rest-1.0...

Your current Flow isn't to far away from recording email activity, but you need to make a decision on how you wish to record the data as this will affect how you store the data in SharePoint... if it's simply a total count then you can just add a single list item, and increment every time an email is received... if you need a daily, weekly, monthly count etc. then you'll need to create a list item for every mail received, you can then use the 'SharePoint Get Items' action and use the 'Filter Query' to return the items which meet the time-frame criteria (1 day, week, etc)... finally just check the length of the returned array.

Finally, I don't think you can record emails sent in this way as there isn't a Flow trigger for sent email.

I'd suggest querying the graph is probably the best solution.

HTH

Jay

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (6,645)