cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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

Hello,

 

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. 

2 REPLIES 2
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:

Capture.PNG

 

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:

Capture.PNG

Capture.PNG

 

 The expression in the "file expression" as below:

concat('.',first(skip(split(body('Get_item')?['The_x0020_File_x0020_Name'],'.'),1)))

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

 

first(split(body('Get_item')?['The_x0020_File_x0020_Name'],'.'))

 

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

concat('{',body('Get_item')?['Employee_x0020_ID'],'}.{',outputs('filename_without_expression'),'}',outputs('file_expression'))

 

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

Capture.PNG

 

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

Capture.PNG

 

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

 

Please let me know if your issue could be solved.

 

 

 

Regards,
Alice Zhang

Anonymous
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

Announcements
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!

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 (4,195)