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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,392)