LogicApps outlook.com connector GetEmails trigger - get oldest emails - azure

I am trying to get oldest emails from outlook.com mailbox within LogicApp. I have done number of test and seems like both triggers available GetEmails and GetEmails(2) always start from the newest messages.
My use case:
Emails after processing are moved to Processed folder and shall be stored there for a month. So am looking for a way to get list of x number of oldest emails to check whether they are older than 30 days, and delete them if condition is met.
With the current functionality, I would have to get all the emails from the folder, what might be few thousands within 30 days time slot. This creates an unnecessary workload on the outlook.com but also within LogicApp. Additionally I am afraid I can reach thresholds for this connector.
Is there a way to get x number of emails starting from the oldest ones?

If you want to get top X oldest emails in a folder of outlook mailbox, you can use Microsoft Graph API by Http action in Logic App to get emails you want directly.
For instance , if I want to get top 5 oldest emails in Processed folder, use the API below :
GET https://graph.microsoft.com/v1.0/users/<username>/mailFolders('Processed')/messages?$orderby=receivedDateTime&$top=5
In logic App :
I have tested on my side and it works perfectly for me.
Details of Microsoft Graph outlook mail API see here .
And how to customize responses from API
And Auth for Microsoft Graph API.
If you have any further concerns, pls feel free to let me know.

Related

How to check Gmail API usage status in Google Console?

I'm sending automated emails from my account to my account, I'm using Integromat (now Make) and I've done all the necessary stuff in the Google Cloud Platform (or Console) to authorize Integromat. The scenario works and I send automated emails.
However when I go to check the usage status to see how many emails I have sent and how many I have left in the Google console, it shows no results.
For reference, I go here https://console.cloud.google.com/apis/api/gmail.googleapis.com/ to check the status, but all the graphs show no data whatsoever, despite the automated mails getting sent normally. I have the correct project selected when doing this.
There is no way to see stats on any of your google usage quotas. The Stats page on Google cloud console. Is at best an estimate and not real time in any sense of the word.
Either create your own counter, or just wait until you get the quota error. I normally go with the latter.

Office 365 Email Trigger when new mail arrives does not fire as required in Azure Logic Apps

I am witnessing quite recently that my Logic App which doesn't fire when a new Mail arrives. It's originally set to look every 1 minute, but regrettably, it doesn't fire at all; sometimes it fires after a big-time lapse.
This Logic App is set to look at any emails which arrive having an attachment of mostly less than 10KB files and the attachment type is *.csv. I am pretty sure I have not breached and office 365 limitations. Further, this Mailbox which is associated with this logic app is also linked with few other Logic apps to trigger when a new email arrives.
What I did so far to resolve this issue:
Decreased time to check new emails from 1 Minute to 45 Seconds
Added the Time-Zone
Changed the Email account
Press the Run Trigger button manually
but nothing seems to work except for point 4; where pressing the Run Trigger button manually fetches the new emails and the workflow continues.
Did anybody face this issue lately?
Thank you hiFI. Posting your suggestions as answer to help other community members.
As When new email arrives V2 is deprecated try using When new email arrives V3
Check the Deprecated for further information

Microsoft Teams - Power Automate - Bot replies to older messages

I’m having a problem with a bot that has to reply automatically when a message is posted in a Teams channel. When it is activated, it also responds to messages that were posted prior to its activation. How can i avoid this ?
Thanks for your help
I'm assuming you're running a flow with a Microsoft Teams trigger.
I can see two possible causes of this.
This first is that Microsoft's Team trigger doesn't work very well and is firing for previous posts while the Flow is disabled. Very plausible
If that's the case you need to make a Condition to check if the post date is greater than the current time minus say 10 minutes, AddMins(UtcNow(),-10). If successful, continue, if not, terminate.
Hopefully, you can pull the post date directly from the Teams trigger, but if not you'll have to use a Teams action to look up information about the given post id provided by the trigger.
The second possibility is that you're not taking the ID from the trigger which will tell you what post to respond to, and accidentally doing some kind of reply to all posts in the channel.

How to use Power Virtual Agents and Power Automate to let a Bot write in a user's outlook-calendar

I have created an bot for microsoft teams with power virtual agents. This bot works fine and people can talk with it in ms teams and give the bot some information about dates. For example you could tell the bot a start-date and an end-date for days you aren't able to work.
With the authentification in teams the bot also knows the username and the id of the person, who is talking with it.
Now I like to create an automated flow, which the bot should trigger with the infos like username, userid, startdate and enddate, which should do the following steps:
open/find the specific user's calendar in outlook/teams (I'm pretty sure both use the same calendar)
create for each day in the range of startdate and enddate a (full-day) entry, which says "unavailable"
for each conflict with another meeting in entries of Step 2. cancel the meeting (for the user with username)
post a summary in a specific ms teams channel
I got Step 4 already working fine.
Step 2, I think I've figured out aswell, but with regard to my following problem at Step 1:
There is the template flow: Get calendar, which returns (all?) available calendars. And there is another flow template for creating entries in a specific calendar(Step 2 with option full-day entry), which needs the calendar ID to work.
My big problem is, how am I supposed to get the calendar ID of a specific user?
Is there a way to get the specific calendarID for a username or a userid?
And then what can I do about Step 3?
Thank you a lot for your help.
greets Vulnin
Using Graph API you can get User Calendar ID GET https://graph.microsoft.com/v1.0/{id | userPrincipalName}/calendar
Parse JSON in use is when you take the raw JSON output data from Power Automate and transform it into values. The output of GET command in http returns raw JSON so, you have to parse JSON to use values.
For point 3 Only the organizer can cancel the meeting. Please refer to this document.
You can decline a meeting using Graph API request with POST https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/events/{id}/decline request.

automation of tasks - email using web application

I have a web application that monitors farms in certain areas. Right now I am having a problem of performing automation with some of the tasks.
Users of the web application can send reports or checkins using keywords. If the reports or checkins correspond to certain keywords, for example "alert", I need the web application to send an alert to the user via email using that web application. But that alert must be sent two weeks after the date of the report received, and to that particular user only.
Would it be possible to use cron to perform this? If not, can anyone suggest me a workaround?
A possible approach you might consider is to store an entry in a database for each of these reminder emails you need to send, at the time your user does whatever action in your application that determines the need to send that email exists. Include the recipient, the date to be sent, and the email content as content you store for each entry. Schedule a single cron job to run periodically to process these database records by due date, and populate an email template to be sent out. You can then either delete the database records, or a better option, include a column that indicates they were sent and mark them as sent.
It would help to provide which technology stack you're operating on and what the application is developed in. Others might be able to point you to technology specific approaches or pre-built plugins/extensions that already do this for the situation you're in, to help you avoid the need to write your own code for the solution.

Resources