cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
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
Highlighted
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
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

Highlighted
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

Highlighted
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

Highlighted
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. 

Highlighted
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"

Highlighted
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!

Highlighted
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. 

Highlighted
Frequent Visitor

Re: exclude attachment by file type

Don't know I'm new in Flow 🙂

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Kudoed Authors
Users online (6,980)