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

10 REPLIES 10
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
Anonymous
Not applicable

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 III
Helper III

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
Anonymous
Not applicable

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 III
Helper III

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 III
Helper III

Re: exclude attachment by file type

@Anonymous 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
Anonymous
Not applicable

Re: exclude attachment by file type

Don't know I'm new in Flow 🙂

Highlighted
New Member

forRe: exclude attachment by file type

I have the same issue. That for the negative condition it forward lots of forwards of the same email (in my flow if there are not pdf invoice then the rule is to forward that email to somewhere else). THen I realised it is due to the embeded images and some other stuffs part of the HTML emails. So in Flow it treat all those embeded stuffs as each attachment and run the condition for each.

 

Any one know how solve this issue. I only need pdf documents to passed to SharePoint and if there is not pdf document in the email then the email should be forwarded to a particular mailbox as it is.

Helpful resources

Announcements
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (5,639)