Introduction
This article demonstrates how to build a Power Automate flow that automatically adds a category to an email when it arrives in a folder (not in the inbox).
Prerequisites
- A Power Automate account
- Access to the SharePoint site and folder where the email will be stored
Steps
- Sign in to Power Automate (https://flow.microsoft.com)
- Click on "Create" and select "Automated flow"
- Name the flow (e.g., "Add Category to Email in Folder")
- Choose a trigger: "When a new item is added" under "SharePoint" and select the appropriate site and folder
- Add a new action: "Office 365 Outlook" > "Get attachments" from the new item
- Add a "Apply to each" loop action to iterate through the attachments
- Inside the loop, add a "Office 365 Outlook" > "Get email attachment" action to select the desired attachment (e.g., the .msg file)
- Add a "Parse JSON" action to convert the attachment content into a JSON object
- Add a "Set variable" action to store the JSON object in a variable (e.g., "emailJSON")
- Add a "Parse JSON" action to extract the email data from the JSON object
- Add a "Set variable" action to store the parsed email data in a variable (e.g., "emailData")
- Add a "Compose" action to add the "BOARD" category to the email data
- Add a "Send an email" action to send the modified email with the added category
- Set the "To" field to the email address of the recipient
- Set the "Subject" and "Body" fields using dynamic content from the "emailData" variable
- Save and test the flow