cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Highlighted
Community Support
Community Support

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.

Highlighted
New Member

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.

Highlighted
Community Support
Community Support

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
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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!

Top Solution Authors
Top Kudoed Authors
Users online (5,951)