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 we will be archiving emails in SharePoint but you can easily customize this example to save your archive 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:

  • generate PDFs with clear-resolution
  • support all common email content types, including HTML, RTF, and plain text
  • support the conversion of rich content including in-line images and tables
  • support for converting email attachments


Ensure the following prerequisites are in place:

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

Steps for the Flow:

The steps to archive emails using Flow are given below: archive emails with power automate

  1. Create a new Flow and use the ‘When a new email arrives (V3)’ Outlook action.
  • Folder: Inbox
  • Has attachment field: No
  • Include attachments field: Yes

create flow power automate

  1. Use the ‘Export email (V2)’ Outlook action to export the content of the email.
  • Message-Id: ‘Message Id’ is the output variable of the ‘When a new email arrives’ action.

export content of email

  1. Use the ‘Convert email to PDF’ Muhimbi action to convert the exported content of the email.
  • Source file name: Message Id.eml (output variable of ‘When a new email arrives (V3)’) action.
  • Source file content: Body (output variable of ‘Export email (V2)’ action).
  • Include attachments: Yes
  • Attachment action: Default
  • Attachment summary: Yes (To display attachment name in the email header).
  • Unsupported attachment: Error (What should be done with attachments which 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. 1024x768)
  • Paper size: Letter (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 we can specify the XML below in the Override settings parameters field of the ‘Convert email to PDF’ Power Automate action.

create file power automate

  1. Insert a ‘Create File’ SharePoint action to write the converted PDF file back to SharePoint Online.

    • File name: ‘Subject’.pdf the output variable of the ‘When a new email arrives’ action.

    • File content: ‘Processed file content’ the output variable of the ‘Convert EMail to PDF’ action.

      convert email to pdf

  2. 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 is not 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 is possible to display Lists and Libraries in Modern or Classic mode. Modern View is undergoing constant change (by Microsoft), as a result, we currently only support the conversion of pages displayed in Classic View. Some Modern View pages will convert fine while others don't.

  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 such as our HTML converter. If your environment uses MFA then please create an App password for HTML conversions, or disable MFA on your HTML Conversion account.

  3. HTML Conversion option not displayed: The option to convert the current page to PDF is only available in Classic SharePoint pages. Modern pages currently do not provide a facility for extending the personal actions menu. We will make sure it is added as soon as Microsoft makes this functionality available.

  4. PDF Layout does not match: By default, the page being converted is optimized for print / PDF output. If you prefer the PDF to look exactly like what is displayed on the screen, including user interface elements, then set the Media Type to Screen in the HTML Conversion configuration screen.

  5. User-modified content is not converted: The converter does not 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 is not aware of the user carrying out the HTML conversion. Don't specify accounts that display more information than what the users need to have access to.

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

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