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
Thanks in advance
Thanks Victor, 100% right! for other users the flow is like this (working ok):
Regards
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!
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'])
AWESOME, thank you because you explained it so well, you are the best! regards!
@eduardosilvin Sorry if the mis-communication. I have updated my original post for clarification.
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"?
@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.
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.
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()
With your cursor in between the brackets, select the Dynamic Content tab. Insert the value dynamic content from the Get Emails (V3) action.
Run a test. The number of unread emails will be stored in the Compose action.
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
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.
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.
Paste the content from your clipboard and press Done.
In a Compose action use the length() function (refer to instructions above) and insert the value dynamic content from the Parse JSON action.
Run a test. Verify the outputs.
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.
For clarification:
If you are using the Send an HTTP request action, your flow should look like this
If you are not using the Send an HTTP request action, your flow will look like this
Hope this helps!
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional