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

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
moutinhoabreu
Advocate IV
Advocate IV

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

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

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

 

Thanks 

 

MI

Anonymous
Not applicable

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

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. 

Anonymous
Not applicable

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"

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!

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

Anonymous
Not applicable

Don't know I'm new in Flow 🙂

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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (52,297)