cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Help Building Flow for Email Attachments to Sharepoint Doc Library Folders Based on Attachment Name

Hi,

 

I am learning MS Automate, and I would like to accomplish the following:

 

Info: I hate specific forms that are being generated and submitted through Zoho Forms (cloud app) and then the form with attachment is sent to an email. In the subject line and the attachment, there is a 5 digit number. I would like to send the attachments to a Sharepoint library with folders named the 5 digit numbers .. ie ... email comes through with an attachment named 00345 - Random Stuff Here and sends the attachment to the Sharepoint library folder 345 or 00345.

 

How can I accomplish this? Thanks much for the help. 

7 REPLIES 7
manuelstgomes
Community Champion
Community Champion

Hi @Anonymous 

 

You can use the following formula:

 

substring(string(add(sub(float(<PUT THE FIELD HERE>),10),100000)),1,5)

 

 

I know it looks complex but I use it all the time to do exactly the same result.

 

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

Anonymous
Not applicable

Hi Manuel, thank you for the response. When you say I can use the formula below, where exactly do you put that?

Also, where it says PUT THE FIELD HERE ... which field are you referring to? Attachment name or ...?

HI @Anonymous 

 

Probably I didn't understand correctly. If you want to generate your 5 digit number you can use the formula below to achieve that.

 

If you want to get the 5 digit value from the subject line then you can insert it when creating the ID.

 

But again, probably I'm not understanding this correctly. Could you provide an example of your Power Automation so that I can take a look at it.

 

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

Anonymous
Not applicable

Hi Manuel, I haven't created a flow yet. Let me try and explain better.

 

In our dept, we have a form that is on a web application called Zoho Flow.

 

1. Form is filled out by a user.

2. Email is sent to us with information and the attachment. The title of the email as well as the name of the attachment start with a 5 digit number (ie ... 00123) and whatever form they are submitting. So the name of the file can be as an example 00123 - Form 1 Information.

3. The attachment is then manually put into a folder of the same number in Sharepoint. There are many folders, and in the particular example above, the attachment would need to go into a folder on the sharepoint doc library named "00123".

4. If there is an attachment that starts with a number that there is currently NOT a folder for, we would like to put that attachment into a folder named "Other".

 

I haven't began building the flow yet, as I looked at the template and came here hoping not to make a mistake.

Thank you!

Anonymous
Not applicable

I have created a flow that can move attachments to a specific folder, but not dynamically in creating a folder or using an existing folder based off of the first five characters of the subject line to put the attachments.

HI @Anonymous 

 

I think I have a working Power Automation for you. 

 

Here are the steps:

 

Check if the folder exists:

First, you need to check if the folder exists or not. For that, use the following strategy. Get the folder details based on the path. The path is build using the subject line with the numbers returned. 

If it cannot find the details, it will fail, so we pick it up and create the folder. If not, copy all the files.

 

Create two paths

To create two tracks, choose the "parallel branch" when adding a new action.

Screenshot 2019-12-17 at 10.41.01.png

 

Dealing with the exception

You need to define that the parallel branch will only work if something fails. To do so, follow these steps.

small-Screenshot_2019-12-17_at_10_38_21.jpg

small-Screenshot_2019-12-17_at_10_33_27.jpg

 

Include in the end the Terminate as success; otherwise, the Power Automation will always indicate as failed.

small-Screenshot_2019-12-17_at_10_46_34.jpg

 

Full Picture

Here's the whole picture.  I created two versions. 1 to save to the "Other" folder in case of failure or create a new folder with the number. You pick the one you need.

small-Screenshot_2019-12-17_at_10_36_14.jpgsmall-Screenshot_2019-12-17_at_10_46_34.jpg

 

 

 

Does this help you? You'll manage to do it, but if you need more help, we'll continue digging until we find the solution to your problem.

 

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

 

Hi @Anonymous ,

 

Have you had an opportunity to apply @manuelstgomes 's recommendations to adapt your Flow?

Please take a try.

 

Best Regards,

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

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.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,859)