Over the years I’ve considered the number of emails received to be a gauge of how busy I am. For two years I’ve been using Microsoft Flow to track the number of emails received and basic details about the email. I realized recently that I have many flows triggered by an email being received:
- Track the number of emails received in Excel
- Save an attachment received weekly into a specific OneDrive folder
- Push notification when my boss emails me
- Push notification when the CIO of my customers email me
- Push notification when my old boss emails me
Tracking Emails in Azure Logic Apps instead of Flow
This quickly got out of hand, so I decided to use a Logic App. Microsoft Flow is built on Logic Apps, with Logic Apps having more enterprise connectors but also lacking the ability to send a push notification. 2,000 executions per month are free on Microsoft Flow with an Office 365 subscription (as long as the administrator hasn’t taken that right away). However I want to ‘upgrade’ my email tracking/processing solution, so I created a single, larger Logic App that would handle email receipts all at once. I skipped the ones which provide me push notifications.
I first started by recreating the functionality which would add a row in Excel. The trigger is whenever I receive a work email, then add a row with details to Excel. I was even able to keep the original Excel file with all the historical records from the Flow I had been using.
Saving a Report Attachment Automatically
Weekly I receive an email with an attached Excel file containing information about the hours the consultants in my practice have worked. Every week, the email comes from the same person with a particular subject. So I used a Condition to filter out emails that do not meet those criteria.
I want to save the Excel attachment, so I started a ForEach loop, but I realized that the MCA Connect logo is treated as an attachment in the email, so let’s filter those out too-
Now that we have filtered down to the exact attachment to save, let’s go crazy by saving it in two spots and posting a message about it!
First we save the file to my OneDrive. The name I’m using prepends the name with the date I received the file using the following formula: concat(string(utcNow(‘yyyy-MM-dd’)),’ ‘,items(‘For_each_report_attachment’)?[‘Name’])
Then we save that same file into SharePoint Online. This particular site was created by Microsoft Teams and it is shown as a tab within the tool.
Let’s post a message to the channel letting people know the report is available.
I know what you are thinking…why wouldn’t the sender of the report set this up so that when she saves the report into a folder called “Publish” that it would save the report to the SharePoint folder and post a message…well that’s a great idea!!
I wanted to document this to show that Logic Apps can be used easily. I was able to use it here as an individual but it is geared towards the enterprise with extra connections and more depth in logging. I consider it a solid and scalable integration tool- and you should too!