cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
Dual Super User III
Dual 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!



Highlighted
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

Highlighted

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

 

 

 

Highlighted
Dual Super User III
Dual Super User III

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!



Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

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