Skip to main content

Notifications

Community site session details

Community site session details

Session Id : c9KjamMrDT+Jz0OLzukXCg
Power Automate - Building Flows
Answered

Saving email attachments (.msg) with flow

Like (0) ShareShare
ReportReport
Posted on 1 Apr 2019 22:56:22 by

Hello Experts,

 

I m working on flow. where I need to save attachment in Sharepoint Libary. 

It is working for all type of files (pdf, word, xls).. But It doesnt work if email attachment comes with (.msg) or eml

 

A user send email with another email as attachment. So I m wanting to save that attachment into SharePoint. 

It seems .MSG is not being recogized as attachment.

 

Anybody else faced issue like this ?

 

Any help will be much appericaited. 

Regards

T

 

  • xolix Profile Picture
    2 on 16 Jun 2023 at 11:27:28
    Re: Saving email attachments (.msg) with flow

    The user who wants to save or extract email attachments from MSG files then you can try the Gaintools MSG Extractor tool for the safe extraction of attachments from MSG files and make the data easily save in a few clicks.

  • DeeTronSEAM Profile Picture
    396 on 22 Jul 2021 at 22:28:02
    Re: Saving email attachments (.msg) with flow

    At the risk of muddying the water......

     

    If you are trying to get at the attachments inside of an email message, if the attachment is an Outlook item (e.g. calendar event, mail message) or it's an attached email for other mail clients (e.g. GMail), the Get Email (v2) action and the Export Email (v2) action will NOT contain the contents of those attachments in the output of those actions.  But there are two ways to workaround this.

     

    1) Use @Jay-Encodian 's guidance above to pipe the Export Email (v2) action's output into an .EML file (e.g.  SharePoint Create File action) and then users can open that .EML file and get at the attachments (emails, images, DOCX, etc.).

     

    2) Use the Microsoft Graph API's Get Message and Get Attachment endpoints which return those "item attachments" in the output so you can directly manipulate them in your Flow.  The Known Issues section of the Office 365 Outlook connector docs gives some instructions on how to get at the appropriate API endpoints.  https://docs.microsoft.com/en-us/connectors/office365/ 

     

    Here is the relevant info, but see that page for the current info:

     

    There are two types of email attachments:

    • File attachments: Any file, such as a .txt, .jpg, .zip, .pdf etc. A file attachment only has a few properties, one of which is the base-64 encoded content of the file. Latest versions of all triggers support these attachments. EML, MSG and ICS should be attached as files to be available in triggers responses.
    • Item attachments: Email messages and calendar items that are attached to an email. An item attachments has a lot of properties. These attachments are not supported by the connector at the moment. To workaround this issue, you can do the following:

     

     

    If you decide to go straight at the Graph API (e.g. using an Azure Function that gets invoked by your Flow),  make sure you consider usage of the ?$expand=attachments parameter to get the nested message's properties included in your root call.

     

    e.g. GET   https://graph.microsoft.com/beta/users/{id | userPrincipalName}/mailFolders/{id}/messages/{id}/attachments?$expand=attachments

     

     

    P.S.  Big shout out to Encodian (and Jay) for their product Flowr.  At my work we use Flowr for generating PDFs from complex and dynamic templates that were far too painful to do with Word templates. We also use some of its other handy features (e.g. image resizing, QRCode generation).  If you're doing anything with email messages, their attachments, images, PDFs, PDF text extraction, you owe it to yourself and your sanity to use Encodian Flowr.  It's paid for itself many times over at my workplace.  Now back to our regularly schedule program (i.e. PowerAutomate and its MIA features).

  • Drew87K Profile Picture
    2 on 01 Apr 2021 at 21:16:20
    Re: Saving email attachments (.msg) with flow

    Hi all,

    I've a very similar issue - I need to export only the attached email (email is an attachment of the email similarly as @kmw1130  )


    All attachments except of outlook item file (msg or eml) work.  Could you kindly advise what you have done differently at export? I only need to store the attached email (actual email as an attachment) in sharepoint library. Thanks !

     PA1.jpgPA2.jpg

  • NickC001 Profile Picture
    4 on 30 Mar 2021 at 08:02:25
    Re: Saving email attachments (.msg) with flow

    @Jay-Encodian - thanks for the example, how do you "check you're passing the body value from the 'Export Email' action" ?

     

    Here is my flow, the SP list item is created and the attachment with the .eml extension is created but when I open the attachment there is no content in the email and the subject is blank.

    Email-Flow.png

     

    thanks,


    Nick

  • Community Power Platform Member Profile Picture
    on 06 Aug 2020 at 11:47:58
    Re: Saving email attachments (.msg) with flow

    HI,

     

    I am new to sharepoint and while using the "create item" connector I am unable to see anything in the list name option. I have navigated to the site and created a new list manually , but still its not getting populated in the connector

     Any help?

  • kmw1130 Profile Picture
    930 on 17 Dec 2019 at 15:32:59
    Re: Saving email attachments (.msg) with flow

    @Jay-Encodian I have success!!  I have forgotten to add the .eml after the Subject

    attachments.PNG

    Thanks again for all your help!!

  • Jay-Encodian Profile Picture
    2,920 on 17 Dec 2019 at 15:08:08
    Re: Saving email attachments (.msg) with flow

    @kmw1130 

    What are you doing to create the email?

  • kmw1130 Profile Picture
    930 on 17 Dec 2019 at 14:26:08
    Re: Saving email attachments (.msg) with flow

    @Jay-Encodian Somewhat success.  I got it to add both the attachment and the email to the list item, but the email is coded and not in a format that can be easily read.

     

  • kmw1130 Profile Picture
    930 on 17 Dec 2019 at 13:57:54
    Re: Saving email attachments (.msg) with flow

    @Jay-Encodian Yes, that was my entire flow.  I will move the export and retest.

    Thanks again!

  • Jay-Encodian Profile Picture
    2,920 on 17 Dec 2019 at 13:27:04
    Re: Saving email attachments (.msg) with flow

    @kmw1130no probs 🙂

    Is that your full Flow? you need to export the email from the mailbox not from a forwarded mail action... you also need to check you're passing the body value from the 'Export Email' action

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,722 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,069 Most Valuable Professional

Leaderboard