cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thewiteam
Regular Visitor

How to save only certain attachments from outlook to onedrive

I am currently using the pre-made flow that saves attachments from emails to onedrive for business, but I cannot figure out how to get specific file extensions to save to this folder.  I would like to get .pdf, .doc, and .docx to save there but can only get one or the other. 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @thewiteam,

 

Could you please share a bit more about your scenario?

What do you want to do with the specific file extensions?

Do you want to save the attachments which contain .pdf, .doc or .docx file extensions to a OneDrive for Business folder?

 

I have made a test on my side (Create flow with the "Save Office 365 email attachments to OneDrive for Business" built-in template) and please take a try with the following workaround:10.JPG

Within Condition box, type the following formula:

@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'], '.docx'))

The flow works successfully as below:11.JPG

 

 

If I understand incorrectly, please let me know here, I would provide a proper solution for you.

 

Best regards,

Kris

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-xida-msft
Community Support
Community Support

Hi @thewiteam,

 

Could you please share a bit more about your scenario?

What do you want to do with the specific file extensions?

Do you want to save the attachments which contain .pdf, .doc or .docx file extensions to a OneDrive for Business folder?

 

I have made a test on my side (Create flow with the "Save Office 365 email attachments to OneDrive for Business" built-in template) and please take a try with the following workaround:10.JPG

Within Condition box, type the following formula:

@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'], '.docx'))

The flow works successfully as below:11.JPG

 

 

If I understand incorrectly, please let me know here, I would provide a proper solution for you.

 

Best regards,

Kris

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

I have a specific attachment I don't want saved: it's called "PastedGraphic-1.tiff" and it comes with every single email from a particular sender. Do you know how to create a rule that it excludes that particular attachement?

Thanks,

M.

SUggested script did not filter out PNGs. Useless unless graphics in senders' signatures are not excluded. This should only route document types that users actually save.

Anonymous
Not applicable

Is there anyway to save everything but image files (png, jpg, etc)?

have same problem

NHes
Frequent Visitor

The sugested solutions woks in the 'run details'. However it still goes and stores/uploads png files even though the attachments are seen as 'false' to the condition. ie The run conditions demonstrate no action to be taken on false conditions, however still the png files are stored in One Drives.

NewExpression insert.PNGTrueRun.PNGHoweverAllFilesGetUploaded.PNGFalseShouldDoNothing.PNG

Same problem here.

 

Ended having more work building flows than to manually save the files in OneDrive.

 

Anyway, I tried the @NHes expression:

 

@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'], '.docx'))

 

But it returns:
"Invalid expression".

 

Anotação 2020-03-31 145448.png

it does NOT works because it do not save only specific files.

From your knowledge/research I assume there is currently no workaround. Is that your understanding?

naaah, u can do it:

flow.png

 

thanks to AlanPs1

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (5,543)