cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dsummers-iot
New Member

exclude attachment by file type

I am attempting to create a Flow that saves attachments from email to Onedrive - the basic template works just fine but I would like to save only attached files of a certain type i.e. only save the attachment if it is a PDF file. The issue I run into is that image files from users signature lines are saved as attachments along with the PDF file.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
dsummers-iot
New Member

Re: exclude attachment by file type

I ended up creating 3 separate conditions for the 3 file types I want to capture.

 

I used the "File Name" contains and specified the ".pdf" and other extensions I want.

 

The condition states to "Create File" if the condition is met (File name contains the file extension) and Do Nothing if the conditions are not met.

 

It did require that I create 3 separate conditions, one for each file type. 

 

 

View solution in original post

9 REPLIES 9
moutinhoabreu Advocate IV
Advocate IV

Re: exclude attachment by file type

I've the same problem. Please let me know if you find a solution. I'm going to investifgate a little bit.

Highlighted
dsummers-iot
New Member

Re: exclude attachment by file type

I ended up creating 3 separate conditions for the 3 file types I want to capture.

 

I used the "File Name" contains and specified the ".pdf" and other extensions I want.

 

The condition states to "Create File" if the condition is met (File name contains the file extension) and Do Nothing if the conditions are not met.

 

It did require that I create 3 separate conditions, one for each file type. 

 

 

View solution in original post

mirahola
New Member

Re: exclude attachment by file type

Could you please attach a print screen so we have an idea how you set up the flow?

 

Thanks 

 

MI

Bebe
Frequent Visitor

Re: exclude attachment by file type

I added this condition in advanced mode :

 

@or(contains(items('Apply_to_each_Attachment_on_the_email')?['Name'],'.pdf'),

contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], '.doc'),

contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], '.xls'),

contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], '.ppt'))

 

without any blankspaces

Regards

Bebe

rsymmons Helper II
Helper II

Re: exclude attachment by file type

I too am having difficulties only saving certain file types to SharePoint. I'm not sure where I would need to apply this particular condition for only PDF files to be saved automatically. Any assistance greatly appreciated. 

Bebe
Frequent Visitor

Re: exclude attachment by file type

If you want to save only PDF you should add :

 

@contains(items('Apply_to_each_Attachment_on_the_email')?['Name'], '.pdf')

 

in advanced mode between thoses actions "get mail" and "create file"

rsymmons Helper II
Helper II

Re: exclude attachment by file type

Bebe, many thanks not sure what I was doing wrong but after playing around a little more I've managed to get it working. 

 

Thanks!

rsymmons Helper II
Helper II

Re: exclude attachment by file type

@Bebe Sorry to ask but you seem to know your way around Flow. Under the "if no" part of the condition I have setup an auto "reply to email" function however we are receiving multiple emails per email attachment on the email. Do you know a way of only sending one email if the condition is not met? I suspect the "apply to each attachment" part opf the rule is then applying the "if not" per attachment. 

Bebe
Frequent Visitor

Re: exclude attachment by file type

Don't know I'm new in Flow 🙂

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,378)