Great question! When setting up a Power Automate flow to archive emails from Outlook (Office 365) to SharePoint, it's important to take a structured approach. While both metadata and workflow creation are important, the best place to start is with planning and defining your requirements — including metadata — before jumping into building the workflow.
Here’s a step-by-step guide to walk you through the process:
✅ Step 1: Define Your Requirements & Metadata
Before you build anything in Power Automate, ask yourself these key questions:
1. What emails do you want to archive?
- Do you want to archive all incoming emails?
- Only emails from specific senders or domains?
- Emails with certain keywords in the subject or body?
- Emails flagged or labeled with a category?
2. Where in SharePoint should they be archived?
- What site and document library will store the emails?
- Should each email go into a folder based on date, sender, or category?
- Will you use content types or metadata columns for better searchability?
3. What metadata should be captured?
This is crucial for organizing and searching later. Consider capturing:
- Sender email/name
- Subject
- Received date/time
- Categories/Labels
- Importance level
- Email body (HTML or plain text)
- Attachments (yes/no flag or list of file names)
💡 Pro Tip: Create a sample email and think through how you'd like it represented in SharePoint.
✅ Step 2: Prepare SharePoint
Set up your destination in SharePoint:
1. Create a Document Library
2. Add Custom Columns/Metadata
Based on what you defined earlier, create columns such as:
Sender (Person or Text)
Subject (Single line of text)
Received Date (Date and Time)
Importance (Choice column: High/Medium/Low)
Category (if used in Outlook)
You can also use Content Types if you want to enforce structure across different types of emails.
✅ Step 3: Build the Flow in Power Automate
Now that planning is done, time to build the automation!
1. Sign in to Power Automate
Go to https://flow.microsoft.com
2. Create a New Automated Flow
- Choose Automated cloud flow
- Give it a name like "Archive Emails to SharePoint"
3. Choose Trigger
Use the trigger:
When a new email arrives (V3)
From the Outlook – Office 365 connector.
Configure the trigger:
- Mailbox (your account)
- Folder (Inbox by default)
- Apply filters (optional): e.g., only emails from certain people or with specific words
🔍 Tip: Use “advanced options” to filter emails more precisely using OData syntax.
✅ Step 4: Add Actions to Process and Save to SharePoint
1. Initialize Variables (Optional but Helpful)
If you need to format dates or extract values, initialize variables first.
Example:
varFileName = formatDateTime(triggerOutputs()?['receivedDateTime'], 'yyyy-MM-dd-HH-mm-ss') + '-' + triggerBody()?['subject']
2. Convert Email to .msg or .eml File (Optional)
If you want to save the full email, you can use an action like:
- Get email (V3) to retrieve full details
- Then Create file in SharePoint with
.msg or .eml extension
Alternatively, just save the body as text or HTML.
3. Create File in SharePoint
Use:
Create file
From the SharePoint connector.
- Site Address
- Document Library Name
- File Name: e.g.,
triggerBody()?['subject'] or formatted name
- Content: Use
Body from the email trigger or File Content if downloading attachments
4. Add Metadata to the File (Update Item Action)
After creating the file, use:
Update file properties
Map the metadata fields you defined earlier:
- Sender → Person field
- Received Date → Date field
- etc.
✅ Step 5: Test and Refine
- Run test emails through the flow.
- Check SharePoint to see if files and metadata appear correctly.
- Adjust filters or formatting if needed.
✅ Optional Enhancements
-
Move or Flag Email After Archiving
Use “Move email (V3)” or “Update email (V3)” to mark as read or move to a folder.
-
Handle Attachments
Loop through attachments and upload them to SharePoint too.
-
Error Handling
Add conditions or scopes to handle failed uploads gracefully.
🧭 Summary: Where to Start?
| Step | Action |
|---|
| 1 | ✅ Define what emails to archive and what metadata you need |
| 2 | ✅ Set up SharePoint structure (library + columns) |
| 3 | ✅ Build Power Automate flow with trigger and actions |
| 4 | ✅ Test and refine logic |
Would you like me to provide a template flow JSON or help you set up a specific version (e.g., include attachments or advanced filtering)?