Personal Email to SharePoint Archiver
When an email arrives in Outlook.com matching a keyword, save the body and attachments to a SharePoint document library for centralized records.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow monitors an Outlook.com inbox for incoming emails whose subject line contains a configurable keyword (default: ARCHIVE). When a match is found, the flow creates a record in a SharePoint list capturing the email's metadata (subject, sender, received date, body preview, importance, attachment status) and saves any file attachments to a SharePoint document library.
Use Case
Centralized email archiving for compliance, recordkeeping, or project documentation — without requiring an Exchange Online / Microsoft 365 mailbox.
Flow Architecture
When a New Email Arrives
OnNewEmail (Outlook.com)Triggers when a new email arrives in the connected Outlook.com inbox, with `includeAttachments` set to true so attachment content is available to downstream actions.
Initialize Variables
Initialize variable (x3, in parallel)Initializes three string variables from environment variables: `varSharePointSiteUrl` (from `flowlibs_SharePointSiteURL`), `varEmailArchiveListGuid` (from `flowlibs_EmailArchiveListGuid`), and `varEmailKeywordFilter` (from `flowlibs_EmailKeywordFilter`).
Check If Subject Contains Keyword
If conditionCase-insensitive check that the email subject contains the configured keyword, using `toLower()` on both the subject and the keyword variable.
- Create Email Archive Record — SharePoint `PostItem` action that creates a new list item in the archive list with Title, From, ReceivedDate, PlainTextBody, Importance, and HasAttachments columns populated from the trigger output.
- Check If Email Has Attachments — Nested condition evaluating `HasAttachment` from the trigger output. If true, the flow iterates over each attachment with a `For Each Attachment` loop and calls SharePoint `CreateFile` to save the attachment to the `/FlowLibs Email Archive` document library (using `base64ToBinary` to decode the attachment content). If false, no action.
Empty branch — no action.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Target SharePoint site for the archive list and document library. |
| flowlibs_EmailArchiveListGuid | String | <configure> | GUID of the SharePoint list used as the email archive (e.g., 'FlowLibs - Email Archive'). Replace with the list GUID from your target site. |
| flowlibs_EmailKeywordFilter | String | ARCHIVE | Keyword to match (case-insensitively) in the email subject line. Emails whose subjects contain this keyword are archived. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Outlook.com | shared_outlook | OnNewEmail (trigger — includeAttachments: true) |
| SharePoint | shared_sharepointonline | PostItem (Create archive list item) CreateFile (Save attachment to document library) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Import the solution
- Import the FlowLibsPersonalEmailArchiver solution into the target Power Platform environment.
- Configure SharePoint site URL
- Update the flowlibs_SharePointSiteURL environment variable to point at your SharePoint site.
- Create the archive list and capture its GUID
- Create a SharePoint list with columns: Title (text), From0 (text), ReceivedDate (date/time), PlainTextBody (multi-line text), Importance0 (text), HasAttachments0 (text). Then set the flowlibs_EmailArchiveListGuid environment variable to the new list's GUID.
- Set your keyword filter
- Update flowlibs_EmailKeywordFilter to your desired subject-line keyword (default is ARCHIVE).
- Create the attachments document library
- Create a SharePoint document library named FlowLibs Email Archive (or update the folderPath in the Save Attachment action to match the library you want to use).
- Authorize connections
- Sign in to both Outlook.com and SharePoint when prompted to authorize the connection references.
- Turn on the flow
- The flow is delivered in a Stopped (Off) state — enable it after the connections are authorized and the variables are set.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Subject lower-cased for comparison
Left operand of the keyword-match condition; lower-cased for case-insensitive comparison.
EXPR.02Keyword variable lower-cased
Right operand of the keyword-match condition; lower-cased so the comparison is case-insensitive on both sides.
EXPR.03Boolean-to-text for HasAttachments column
Converts the trigger boolean into a Yes/No string for the SharePoint HasAttachments text column on the archive list item.
EXPR.04Iterate email attachments
Input expression for the `For Each Attachment` loop — references the Attachments array on the trigger output.
EXPR.05Decode attachment content for SharePoint upload
Used in the Save Attachment to SharePoint action — decodes the base64 attachment content into binary file bytes for `CreateFile`.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.