cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pauly1546
Level: Power Up

How to save attachments from outlook to different folders in Box depending on the file name

Hello,

 

So the title is the gist of what I am trying to do. Right now I have a flow set up that saves specific attachments when they come to my inbox. These files have a standard naming style that is used when they send us the document, it will be something like "Staff_Research_lab_12345_John_Doe_Offer.pdf". So once that file is in our Box folder we then move it over to a folder that matches that number, the problem I am coming into is that the end folder is behind 3 other folders and would change depending on the file. SO for this example, we would go to the Staff folder and then move to the Research Lab folder and then end with the folder 12345 as the final location for that file. But those three folders would change if we got back a different file name for example, "Technical_Service_BAS_28763_Jane_Doe_Offer.pdf'. Would it be possible to have a flow configured to route these files through the multiple folders as I described? 

 

This is my first time posting so sorry for any formatting issues, or if I am unclear. If I can clarify anything please let me know and thank you all in advance for any help!

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to save attachments from outlook to different folders in Box depending on the file name

Hi @pauly1546,

 

If these folders with special number are not much, you can juxtapose conditional structure that attachment file name contains "12345",  attachment file name contains "45678",  attachment file name contains "78954", etc. If it met the condition, create file in the corresponding folder.

Annotation 2019-11-07 112916.png

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

pauly1546
Level: Power Up

Re: How to save attachments from outlook to different folders in Box depending on the file name

Thanks for the advice, I did look into a condition like this but since the folders change depending on the file and the area that sends it in and we are also adding other folders depending when a new posting is created. So it would be extremely difficult to set up thousands of conditions to filter like that. 

 

I would like to have it set up to take the file and look at the name and see that the file is from the research lab and then look in a folder titled research lab for that specific posting number. And do the same for the other areas like the office of the controller or athletics and look in those specific files for the posting number that is in the file name.

Community Support Team
Community Support Team

Re: How to save attachments from outlook to different folders in Box depending on the file name

Hi @pauly1546,

 

You can use the split() function:

split('Staff_Research_lab_12345_John_Doe_Offer.PDF','_')

Then filename will become:

["Staff","Research","lab","12345","John","Doe","Offer.PDF"]

 

Then split the folder name:

split('Test_item_lab_12345_research1','_')

Then the folder name will be:

["Test","item","lab","12345","research1"]

 

Then use the intersection function:

intersection(["Staff","Research","lab","12345","John","Doe","Offer.PDF"],["Test","item","lab","12345","research1"])

The result will be ["12345"], it is possible to return some words, such as research name, etc.

Because the members of the array is string format, so we should convert it into an integer, if some member could be converted into an integer, the file name contains the number of folder number.

 

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

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 (Last 30 Days)
Users online (5,358)