One of the most common requests in any IT department is: “Can we stop saving email attachments manually?”
Whether it’s invoices from vendors, reports from automated systems, or project files from clients, manual filing is prone to error and incredibly boring. Fortunately, Power Automate makes this trivial to solve.
In this guide, we will build a robust flow that doesn’t just “dump everything,” but intelligently files attachments based on criteria.
The Goal
We want a flow that:
1. Triggers when a specific email arrives (e.g., from invoices@vendor.com).
2. Checks if it has attachments.
3. Filters out junk (like signature images).
4. Saves the valid file to a specific SharePoint Document Library.
Step 1: Create the Trigger
- Go to make.powerautomate.com.
- Create a Automated cloud flow.
- Search for the trigger: “When a new email arrives (V3)” (Office 365 Outlook).
- Important: Click “Show advanced options”.
- Include Attachments: Set to
Yes. - Only with Attachments: Set to
Yes. - Subject Filter: Enter “Invoice” (optional, but good for filtering).
- Include Attachments: Set to
Step 2: The Loop
Because an email can have multiple attachments, Power Automate automatically puts the next steps into an “Apply to each” loop.
- Add a new action: “Apply to each”.
- Select the Attachments dynamic content from the email trigger.
Step 3: Filtering the Junk
We don’t want to save every image001.png from someone’s email signature.
- Inside the loop, add a Condition.
- Set the condition:
Attachment Is Inlineis equal tofalse.- Note: Sometimes “Is Inline” isn’t enough. You might check
Content-Typedoes not containimage/.
- Note: Sometimes “Is Inline” isn’t enough. You might check
Step 4: Create File in SharePoint
If the condition is True (it’s not an inline image), we save it.
- In the “If yes” branch, add an action: “Create file” (SharePoint).
- Site Address: Select your SharePoint site.
- Folder Path: Choose the destination folder (e.g.,
/Shared Documents/Invoices/). - File Name: Select Attachments Name from dynamic content.
- File Content: Select Attachments Content from dynamic content.
Step 5: Handling Duplicate Names
What happens if you receive two files named Invoice.pdf? The flow will fail by default.
To fix this, go to the Settings of the “Create file” action (the three dots ...).
* Turn off “Fail on error” isn’t the right way.
* Instead, change “File Name” to include a unique ID, like: @{triggerOutputs()?['body/receivedDateTime']}_@{items('Apply_to_each')?['name']}.
* Or use the “Move file” action later to rename it.
For simple flows, just appending the “Received Time” to the filename is the easiest robust solution.
Testing
- Click Test (top right) -> Manually.
- Send yourself an email with an attachment (matches your subject filter if you set one).
- Watch the flow run Green!
You now have a permanent, automated archive of your critical documents.
