Archive Emails Using Power Automate

In this guide, you’ll learn how to automatically archive emails using Power Automate and Muhimbi PDF Connector. For this example, you'll be archiving emails in SharePoint, but you can easily customize this example to save your archived emails to destinations like Dropbox, Google Drive, OneDrive, or any platform supported by Power Automate.

For accurate email archiving, it’s important to support the following:

  • The ability to generate PDFs with clear resolution
  • All common email content types, including HTML, RTF, and plain text
  • The conversion of rich content, including inline images and tables
  • The ability to convert email attachments

Prerequisites

Ensure the following prerequisites are in place:

  • An Office 365 subscription with a SharePoint Online license.
  • A full or free trial subscription to Muhimbi PDF Converter for Power Automate.
  • Appropriate privileges to create flows.
  • Working knowledge of SharePoint Online and Microsoft Power Automate (Flow).

Overview

The image below outlines the steps necessary to archive emails.

archive emails with power automate

1: Creating a New Flow

Create a new flow and use the When a new email arrives (V3) Outlook action. Specify the following in the given fields:

  • Folder — Inbox
  • Include Attachments — Yes

create flow power automate

2: Exporting the Email

Use the Export email (V2) Outlook action to export the content of the email. Specify the following in the given field:

  • Message Id — Message Id is the output variable of the When a new email arrives action.

export content of email

3: Converting to PDF

Use the Convert email to PDF Muhimbi action to convert the exported content of the email. Specify the following in the given fields:

  • Source file nameMessage Id.eml, which is the output variable of the When a new email arrives (V3) action.
  • Source file content — Body, which is the output variable of the Export email (V2) action.
  • Include attachments — Yes
  • Attachment action — Default
  • Attachment summary — Yes (this enables displaying the attachment name in the email header).
  • Unsupported attachment action Error (this is what should be done with attachments that cannot be converted into PDF).
  • Include attachment filter — No configuration required.
  • Exclude attachment filter — No configuration required.
  • Viewport size — Paper (specify the viewport size for the conversion in pixels, e.g. 1024×768).
  • Paper size — Letter (the paper size for the output)
  • Paper size (custom) — No configuration required
  • Page margins — 0.5,0.5,0.5,0.5
  • Attachment errors — No configuration required (How to deal with failure when converting attachments)
  • Min. image size — 150 (exclude images smaller than the specified number of pixels).
  • Offline mode No (in offline mode, external resources are disabled).
  • Start page — No configuration required (The first page to include)
  • End page — No configuration required (The last page to include)
  • Conversion quality — No configuration required (Quality of the output file).
  • Override settings — (Optional settings using Muhimbi’s XML syntax) — Muhimbi PDF Converter also provides some brilliant PDF/A support. To control the PDF version on a request-by-request basis, you can specify the XML below in the Override settings parameters field of the Convert email to PDF Power Automate action.

create file power automate

4: Creating a File

Insert a Create file SharePoint action to write the converted PDF file back to SharePoint Online. Specify the following in the given fields:

  • File Name.pdf, which is the output variable of the Convert Email to PDF action.

  • File Content — Processed file content, which is the output variable of the Convert Email to PDF action.

convert email to pdf

5: Publishing the Workflow

Publish the workflow and send any email. After a few seconds, the flow will trigger and a converted PDF file will be generated in the target location.

Troubleshooting/Caveats

HTML isn’t the best format for print or PDF conversion purposes. Depending on your exact needs and source material, you may need to experiment with various available settings. If you have any questions or require assistance, please feel free to contact us.

Please consider the following when using Power Automate:

  1. Modern views — In SharePoint Online, it’s possible to display lists and libraries in modern or classic mode. Modern view is undergoing constant change (by Microsoft), and some modern view pages will convert fine, while others don’t. As a result, we currently only support the conversion of pages displayed in classic view.

  2. Multi-factor authentication (MFA) — An increasing number of SharePoint Online/Office 365 environments are secured using MFA. Although this is a positive development, it gets in the way of automated systems, including our HTML converter. If your environment uses MFA, create an app password for HTML conversions, or disable MFA on your HTML conversion account.

  3. HTML conversion option isn’t displayed — The option to convert the current page to PDF is only available in classic SharePoint pages. Modern pages currently don’t provide the ability to extend the personal actions menu. As soon as Microsoft makes this functionality available, we’ll add it.

  4. PDF layout doesn’t match — By default, the page being converted is optimized for print/PDF output. If you prefer for a PDF to look exactly like what’s displayed onscreen, including user interface elements, set the Media Type to Screen in the HTML conversion configuration screen.

  5. User-modified content isn’t converted — The converter doesn’t have knowledge about the information currently displayed in the user’s browser (e.g. size of the browser window, or custom data entered but not yet submitted to the server). The converter always requests a fresh copy of the URL and converts that information to PDF.

  6. User-specific information is missing — HTML conversion is carried out in the context of the configured user account, though the system isn’t aware of the user carrying out the HTML conversion. Don’t specify accounts that display more information than what users need to have access to.

Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2024
This website uses cookies to ensure you get the best experience. Learn more