cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NotJamez
Regular Visitor

Automate moving files in SharePoint based on the file name

I know this question has been asked in different ways but I can't seem to connect the dots for what I'm working on. Recently we started using teams. One of the things I was assigned to do is set up a channel for our managers to send their daily reports. The reports would then need to be filed in folders based on the area of responsibility associated with the report. 

 

So is it possible to have files moved to separate folders based on the name of the file? Example: 2nd Main or 2nd Refresh. If so will is it safe to assume each folder will require it's on flow?

 

Thank you for any assistance anyone is able to provide. I'm definitely out of my element. Somehow I've become the team IT guy because I figured out a few macros in excel. lol

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @NotJamez,

 

Yes, you could use the Condition action to move the file if the filename contains the keywords, for example:

If the filename contains keyword1, move it to Folder 1, or do nothing and perform the following condition to judge whether it contains keyword2, keyword3, etc.

Annotation 2020-03-10 134146.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.

View solution in original post

5 REPLIES 5
efialttes
Super User III
Super User III

Hi!

"So is it possible to have files moved to separate folders..."?

Were do the files come from? I mean, are they uploaded/created in the same source folder, and as soon as they are uploaded/createdyou need to move them to different folder, based on the name given?

 

I am also assuming files are stored in Teams group related Sharepoint site, right?

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



v-litu-msft
Community Support
Community Support

Hi @NotJamez,

 

Yes, you could use the Condition action to move the file if the filename contains the keywords, for example:

If the filename contains keyword1, move it to Folder 1, or do nothing and perform the following condition to judge whether it contains keyword2, keyword3, etc.

Annotation 2020-03-10 134146.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.

View solution in original post

With only one condition it works great, but when I add the 2nd one I get the error below.

 

Under Condition 2

InvalidTemplate. Unable to process template language expressions for action 'Condition_2' at line '1' and column '2802': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.

Flow 1.PNG

 

Flow 2.PNG

 

Flow 3.PNG

 

 

 

Hi

 

Please add a Terminate action block with Status 'Succeeded' just after 'Move File 2' inside the true branch of your first Condition.

https://powerusers.microsoft.com/t5/General-Power-Automate/Can-I-do-quot-Terminate-quot-action-as-qu...

 

Thanks!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Hi @NotJamez,

 

It's weird, I test on my side but not have the same issue, how about using the string() function to convert the dynamic content and keywords into a string, or you could input the filename with extension in the left of the condition:

Annotation 2020-03-11 150126.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.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,849)