Showing results for 
Search instead for 
Did you mean: 
Not applicable

Microsoft Flow / Sharepoint - Copy to folder based on list ID?



I currently have a list called HR forms. 

List Columns are
File Name , Employee ID

Ideally, I wanted the file to be renamed to {Employee ID}.{File Name} and then moved to the corresponding restricted access folder. Unfortunately renaming is not possible but luckily I can create a copy and delete the one uploaded. However, I'm struggling to figure out how I would have the file copied to the correct folder. 

Community Support Team
Community Support Team

Re: Microsoft Flow / Sharepoint - Copy to folder based on list ID?

Hi @ Dozers,


Could you please explain more about your requirement?


Do you want to save the file to corresponding restricted access folder in your sharepoint library when a file is created in a folder in your sharepoint library?


Do you want to rename the file to {Employee ID}.{File Name}? Does the value in the "Employee ID" column,and "File Name" column is in a special item? 

Could you please share an example of the new file's name?


Such as if an item in the list with ID "1",and the "Employee ID" of the item is "123", the "File Name" of the item is "test.xlsx", when a file is created in library1,the flow would copy the file to library2,and the file would be renamed to {123}.{test}..xlsx ?


If you would like to achieve something such as my example,please refer to steps below to achieve your needs:

I have created a sharepoint list as below:



The list only have one item which's ID is "1", and I would create a flow to create a file and the file's name is {123}.{test}.xlsx .


The screenshot of the flow as below:




 The expression in the "file expression" as below:


The expression in the "filename without expression" as below:




The expression in the "new file name" as below:



The flow would run successfully to create the new file in the library2 when a file is created in library1 as below:



However,even though the file is created in the library2, the filename in the library2 would be "_123_._test_.xlsx" as screenshot below:



Maybe the filename in the flow would convert the "{" and "}" to "_" automatically.


Please let me know if your issue could be solved.




Alice Zhang

Not applicable

Re: Microsoft Flow / Sharepoint - Copy to folder based on list ID?

I tried to replicate your solution but am unable to bring up the purple connector { } that lets me manually enter in the expressions.

Helpful resources


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,195)