cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
unionj
Level: Powered On

Flow that saves different email attachments to different SharePoint folders

Hi, New to flow and hitting a snag with the new conditions.

 

I set up a flow based on the standard template for saving an email attachment which worked fine. I tried ot implement a condition such that it sends pdfs to one folder and all other file types to an "image" folder. Something seems to be off about it as it's still saving both files to the pdf folder. I have it setup as such:

 

Flow Attachment issue.png

Anyone have an idea for how to get the attachments appropriately split up?

1 ACCEPTED SOLUTION

Accepted Solutions
dvdalen
Level: Powered On

Re: Flow that saves different email attachments to different SharePoint folders

Hi @unionj ,

 

I created a testflow and I think this meets your request:

 

2019-04-18 09_15_11-Edit your flow _ Microsoft Flow.png

 

What I did in the file content part of the create file action is to put this in the expression:

 

items('Apply_to_each')?['ContentBytes']

View solution in original post

5 REPLIES 5
dvdalen
Level: Powered On

Re: Flow that saves different email attachments to different SharePoint folders

Can you create a compose action with the attachments variable in it. Then run the flow and check for the outcome of the compose. There you can check if its really ending with .pdf. I think it's not a string but an object that you can't check like this. 

unionj
Level: Powered On

Re: Flow that saves different email attachments to different SharePoint folders

Thanks for the response. I followed the method noted here: Flow that saves different email attachments to different SharePoint folders. I've been able to get it to recognize individual attachments, i.e. when there is 1 PDF attachment it goes to the PDF folder; if there is 1 PNG attachment it goes to the IMAGE folder. So i think the step is reading the "attachments name" variable right.

 

However, when there are 2 different attachments (one PDF and one OTHER), it's sending both of them to the YES flow. In the YES route, I am only able to reference the "Attachments" variable in the field "Select and output from previous steps". Is it possible to split that so it only pulls in the relevant PDF attachment?

 

The only other option it gives me it "Current item", but that fails.

dvdalen
Level: Powered On

Re: Flow that saves different email attachments to different SharePoint folders

Hi @unionj ,

 

I created a testflow and I think this meets your request:

 

2019-04-18 09_15_11-Edit your flow _ Microsoft Flow.png

 

What I did in the file content part of the create file action is to put this in the expression:

 

items('Apply_to_each')?['ContentBytes']

View solution in original post

Highlighted
unionj
Level: Powered On

Re: Flow that saves different email attachments to different SharePoint folders

Thanks! I was able to get it to work based on what you setup. However, I needed to change the condition back to

 

Attachment Name 'ends with' .pdf

 

When I did the Attachment 'equal to' application/pdf, it would not identify the pdf correctly and it would send both to the IMAGES file.

 

I had to restart the "If yes" path from scratch. It actually had multiple steps and was requiring an input of "Attachments". Once I redid it with "Compose" it didn't ask for it anymore.

 

What does "Compose" do?

 

EDIT: @dvdalen , I also had to change the "File Content" back to "Attachments Content". Using the "items" method you suggested created a file that wasn't viewable. Once changed to "Attachments Content" it appears to only apply it to the correct file.

Thanks!

dvdalen
Level: Powered On

Re: Flow that saves different email attachments to different SharePoint folders

Good to know Smiley Wink

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: 285 members 5,367 guests
Please welcome our newest community members: