cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gavril
New Member

Identify emails which contains an Outlook file (another email) as attachment.

Hello,

I'm using a flow which has as trigger "when a new email arrives into a mailbox". Basically, there is a simple condition: if email received contains specific keywords Will be moved in folder A, else Will go in folder B. Now, i need another condition: if The email received has as attachment an Outlook file (email), IT need to go to folder B. Basically, i somehow need to identify  The attachment type (pdf, xls, .msg), read it and if it's .msg i'll move it to folder B

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Gavril,

use "Export email (V2)" action and analyze its output. If you find these headers:

Content-Type: message/rfc822
Content-Disposition: attachment;

then a message has the embedded message.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

View solution in original post

7 REPLIES 7
Heartholme
Super User
Super User

Hi @Gavril

 

This should do the trick:

 

Add a condition which filters on the 'Attachment Name'. By putting the attachment name directly into the condition, it will automatically put it in a apply to each, so you can iterate through each attachment and check if the filename contains the file you would like. To do this with Outlook attachment use the filter: .oft.

 

Please be advised that you can't drag a email from one to another and send it to your flow (then it will have .msg fileformat, which is just Unicode encoding and therefore not recognized as an attachment), you have to save it as "Message format in outlook (not UTF)", which has filename .oft.

 

On the next step I didn't know if you wanted to place it in a folder in Sharepoint or OneDrive etc, but let me know if you run into some issues here and I can assist you 😄

 

Heartholme_0-1652030502194.png

 

By the way, in the 'No' part of the condition you could put another condition to filter out the email signature, which will be attached as an attachment. You could do this by filtering out .jpg in the filename, or the signature name of your email.

 

{ Please click Accept as solution ✔ if my post answered your question. }
{ This will in turn help others find solutions to similar questions. }

Best Regards
Heartholme

 

GavrilLador
New Member

@Heartholme many thanks. I think the below item you highlighted is the problem I have...people are dragging emails into another one and sends them to Flow so .msg format is generated...is there any way in which I can identify such emails and send them to a different folder?

 

"Please be advised that you can't drag a email from one to another and send it to your flow (then it will have .msg fileformat, which is just Unicode encoding and therefore not recognized as an attachment), you have to save it as "Message format in outlook (not UTF)", which has filename .oft."

Heartholme
Super User
Super User

@Gavril @GavrilLador 

 

Sorry, it's not possible to read .msg in PowerAutomate (or even find them in the email output). You could try to use an office add-in or a VBA to do this. As far as I'm aware. 

 

I think the easiest/best way is to work around this and communicate with the stakeholders that they need to save it in the correct format in order to get the attachment processed correctly. 

 

I guess this isn't the answer you were looking for, but this is unfortuneatly a limitation of PowerAutomate. Hopefully I was able to clear this up atleast 😊

 

{ Please click Accept as solution ✔ if my post answered your question. }
{ This will in turn help others find solutions to similar questions. }

Best Regards
Heartholme

Hi @Gavril,

use "Export email (V2)" action and analyze its output. If you find these headers:

Content-Type: message/rfc822
Content-Disposition: attachment;

then a message has the embedded message.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
GavrilLador
New Member

@VictorIvanidze Many thanks! it worked!:)

@Heartholme many thanks also for your support

Glad to help. Mark my answer as a solution if you're satisfied.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

I have the same issue and your solution works good for me. I save the original email if it includes an *.msg attachment.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (4,762)