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

Save email attachments with specific words in name

I'm really new to Power Automate... as in I didn't know it existed before Friday!

 

I'm trying to create a flow which will save any Risk Assessments we send or receive by email to a folder. I don't care where they're saved (hard drive, SharePoint, OneDrive etc), but all I can currently do is save every single attachment. I don't understand how to just look for something with 'Risk' AND 'Assessment' in the attachment name. 

 

Help!! 😊

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Save email attachments with specific words in name

Hi @Magikmissy 

 

We're almost there. I think the path is not correct still. You're defining the path on your computer, but since Power Automate runs on the cloud, it needs a "relative" path to your OneDrive. 

 

Try the following.

 

Tap on the folder and continue until you find the folder you want. Then click on the name, and the path will be filled-in for you.

 

Screenshot_2020-01-16_at_09_38_39.jpgScreenshot_2020-01-16_at_09_38_46.jpg

 

I'm sure that will solve your "Bad Request" issue :).

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

15 REPLIES 15
Super User
Super User

Re: Save email attachments with specific words in name

HI @Magikmissy 

 

First of all welcome to Power Automate! Glad that you're here automating stuff. 🙂

 

Please check if this is what you need. 

Screenshot_2020-01-13_at_11_25_37.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

Thank you @manuelstgomes  Is this right?scrn.jpg

Community Support Team
Community Support Team

Re: Save email attachments with specific words in name

Hi @Magikmissy ,

 

Your flow is correct and you could achieve your requirement with the flow.

 

Best regards,

Alice       

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

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

 

Hi @v-alzhan-msft and @manuelstgomes , 

 

Thanks for your helkp but it's just not working. It shows that the runs were successful, but no attachments are saving onto my OneDrive. 

 

scrn.jpg

 

Super User
Super User

Re: Save email attachments with specific words in name

Hi @Magikmissy 

 

Can you please click one of the runs and check the "For Each". We need to check how many attachments are there (runs were made) to ensure that we get the attachments correctly. 

 

LIke @v-alzhan-msft  mentioned your flow is correct, so we need to understand where is the detail that is missing.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

Thanks @manuelstgomes. I couldn't find anything that said "For Each" but I found this... does that help...? (Sorry to be a pain!)

 

scrn.jpg 

Super User
Super User

Re: Save email attachments with specific words in name

Hi @Magikmissy 

 

It does help thanks.

 

This means that, even if you have attachments, none is named like you want them to. You can check that in the "Body" JSON file in your screenshot and scroll down to check the attachment names. I'm sure that the names won't be  'Risk' AND 'Assessment' so they fail the IF and don't get saved.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

Sorry - I'm probably being really thick here...! Is this the bit you mean? I just want it to save things where what it's called contains both 'Risk' and 'Assessment'. 

scrn.jpg

Super User
Super User

Re: Save email attachments with specific words in name

Hi @Magikmissy 

 

No worries. I probably didn't explain it correctly. 

 

Check the run history and, in the "Body" before the IF statement finds in the huge text there the file attachment name. You'll see that the names of the files that you find there won't be called as you want them.

scrn.jpg

 

If you want, copy the full text and paste it here or send me as a DM if you don't want to make stuff public and I'll try to help you find the information.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

 

 

Super User
Super User

Re: Save email attachments with specific words in name

HI @Magikmissy 

 

Thanks for sending me the information. You do have a file called "Risk Assessment.docx," so the file should be saved.

 

But I just noticed something in your original post. You're using a SharePoint path in the "Create File" action. If you want to save it into OneDrive, you should have a path like "/Documents/path1/path2" and not a SharePoint URL.

scrn.jpg

 

If you want to save it to SharePoint, you need to use the SharePoint action instead. 

 

Can you please try to pick the folder and rerun the Flow so that we're sure that it's saving in OneDrive?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

OK, so I did that and it still didn't save anything! I don't know what I'm doing wrong! 😩

scrn1.jpgscrn2.jpg

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

Hi @manuelstgomes

OK, so I got bored and started fiddling... ha ha! I changed the Attachment name contains bit so that instead of two lines with one word on each, there's now one line asking for it to contain 'Risk Assessment'. I have a new error now and wondered if it gives any insight?

scrn1.jpgscrn2.jpg

Super User
Super User

Re: Save email attachments with specific words in name

Hi @Magikmissy 

 

We're almost there. I think the path is not correct still. You're defining the path on your computer, but since Power Automate runs on the cloud, it needs a "relative" path to your OneDrive. 

 

Try the following.

 

Tap on the folder and continue until you find the folder you want. Then click on the name, and the path will be filled-in for you.

 

Screenshot_2020-01-16_at_09_38_39.jpgScreenshot_2020-01-16_at_09_38_46.jpg

 

I'm sure that will solve your "Bad Request" issue :).

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Magikmissy
Level: Powered On

Re: Save email attachments with specific words in name

Hi @manuelstgomes

Thank you!!!

This has solved the issue!!! My boss is going to love this!!!

Super User
Super User

Re: Save email attachments with specific words in name

Awesome :). Glad to hear it 🙂

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

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 Solution Authors
Top Kudoed Authors
Users online (6,014)