cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dsummers-iot
Level: Power Up

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
dsummers-iot
Level: Power Up

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
Level: Powered On

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.

dsummers-iot
Level: Power Up

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
Level: Power Up

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

Re: exclude attachment by file type

Don't know I'm new in Flow 🙂

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 329 members 5,862 guests
Recent signins:
Please welcome our newest community members: