Count Email Attachments and Add to SharePoint list with Power Automate
Automatically Save Email Attachments to OneDrive with Power Automate
Jonathon Silva from Pragmatic Works walks viewers through an efficient way to automatically save email attachments to OneDrive using Microsoft Power Automate. This tutorial focuses on creating a cloud flow that intelligently sorts attachments based on whether the sender is inside or outside of the organization.
Setting Up the Trigger
Jonathon begins by explaining the importance of choosing the right trigger for the flow. In this example, the trigger is “When a new email arrives”. Key points include:
- Include email attachments in the flow.
- Only target emails that actually contain attachments to reduce unnecessary processing.
- Optionally, apply a subject filter to only capture emails with certain keywords.
Defining Conditions
Next, Jonathon adds a condition to differentiate between internal and external emails:
- Use the sender’s email address to identify internal emails (e.g., containing “pragmaticworks.com”).
- This ensures that all internal emails are grouped together rather than checking individual names.
Creating Files in OneDrive
Once the condition is set, the flow creates files in specific OneDrive folders:
- For internal emails:
- Create a file in the “Pragmatic Works Attachments” folder.
- Use the attachment name as the file name and attachment content as the file content.
- For external emails:
- Create a file in the “Customer Documents” folder.
- Again, attachment name and content are used to ensure proper storage.
Jonathon emphasizes the use of “Apply to each” to handle multiple attachments in a single email, ensuring each attachment is saved individually.
Renaming Actions for Clarity
For better organization and readability, he recommends renaming actions within the flow:
- “Apply to each email attachments from pragmatic”
- “Create file in Pragmatic Works attachments”
- “Apply to each email attachments from outside customers”
- “Create file for customers”
Testing the Flow
Jonathon demonstrates testing the automated flow in two scenarios:
- Sending an email from an internal address:
- The flow correctly detects the sender as internal.
- The attachment is saved in the “Pragmatic Works Attachments” folder.
- Sending an email from an external address:
- The flow recognizes the sender as external.
- The attachment is saved in the “Customer Documents” folder.
Both tests confirm that the flow works seamlessly, automatically sorting attachments based on the sender’s domain.
Key Benefits
- Eliminates manual saving of email attachments.
- Keeps internal and external attachments organized in separate folders.
- Reduces human error and increases workflow efficiency.
- Can handle multiple attachments in a single email effortlessly.
Conclusion
Jonathon Silva concludes by highlighting how Power Automate can simplify everyday tasks and improve productivity. By setting up a cloud flow as demonstrated, users can ensure all email attachments are automatically organized in OneDrive based on whether they originate from inside or outside the organization.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Automate and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.
Sign-up now and get instant access
ABOUT THE AUTHOR
Jonathon Silva is a Trainer for Pragmatic Works, specializing in the Power Platform. He graduated from James Madison University in 2011, has a master’s degree in Education, and comes with 9 years of teaching experience in high school economics and history. Jonathon has consistently been recognized as a top educator in the field of history and leader in curriculum development. His primary focus is helping our customers learn the ins and outs of Power Apps and Power BI.
Free Community Plan
On-demand learning
Most Recent
private training

Leave a comment