cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dmistry Post Prodigy
Post Prodigy

How to rename a SharePoint file name upon upload in the document library using Microsoft Flow?

Hello,

 

One of the Projects I am working on, I have a requirement to rename the SharePoint Document Library file name upon upload. Basically I have a lookup column called 'Entity ID' from which the user selects a value before hitting on Save or CheckIn as its a mandatory field. This will be the case for every file upload in this specific library location.

 

Let's say the Uploaded file name was: "Test Accounting" and the chosen Entity ID value was "15001". So once the user hit on save or checkin buttons the document in the library, then the renamed file name would look like: "Test Accounting 15001". Bascially the selected Entity ID value must be appended to the end of the File name as renaming convention while uploading or post upload.

Is this possible to do using Flow? Please help if anyone knows, thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: How to rename a SharePoint file name upon upload in the document library using Microsoft Flow?

Hi @dmistry,

 

Could you please share a bit more about your SharePoint library?

Do you want your flow to rename your uploaded file after you selected a value within Entity ID field and clicked the Save button?

 

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When a file is crated or modified (properties only)" trigger.
  • Add a Condition, click "Edit in advanced mode", type the following formula:
@not(empty(triggerBody()?['Entity_x0020_ID']))
  • Within "If/yes" branch of Condition, add a "Get file content" action, specify Site Address and File Identifier field set to Identifier dynamic content of the trigger. Add a "Create file" action, specify Site Address and the Folder Path set to another SharePoint library. File Name set to following formula:
concat(split(triggerBody()?['{FilenameWithExtension}'],'.')[0],' ',triggerBody()?['Entity_x0020_ID']['Value'],'.',split(triggerBody()?['{FilenameWithExtension}'],'.')[1])

File Content field set to File Content dynamic content of the "Get file content" action.

 

Then add a "Delete file" action, specify Site Address and the File Identifier field set to Identifier dynamic content of the trigger.

 

Add a "Copy file" action, specify Site Address, Source File Path set to Path dynamic content of the trigger, Destination File Path field set to Folder path dynamic content of the trigger and the DisplayName dynamic content of the "Create file" action.

 

Add a "Delete file 2" action, specify Site Address and the File Identifier field set to Id dynamic content of the "Create file" action.

 

Image reference:27.JPG

 

28.JPGNote: The Entity ID column is a Lookup type column in my SharePoint library.

 

 

 

The flow works successfully as below:29.JPG

 

30.JPG

 

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
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

2 REPLIES 2
Community Support
Community Support

Re: How to rename a SharePoint file name upon upload in the document library using Microsoft Flow?

Hi @dmistry,

 

Could you please share a bit more about your SharePoint library?

Do you want your flow to rename your uploaded file after you selected a value within Entity ID field and clicked the Save button?

 

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When a file is crated or modified (properties only)" trigger.
  • Add a Condition, click "Edit in advanced mode", type the following formula:
@not(empty(triggerBody()?['Entity_x0020_ID']))
  • Within "If/yes" branch of Condition, add a "Get file content" action, specify Site Address and File Identifier field set to Identifier dynamic content of the trigger. Add a "Create file" action, specify Site Address and the Folder Path set to another SharePoint library. File Name set to following formula:
concat(split(triggerBody()?['{FilenameWithExtension}'],'.')[0],' ',triggerBody()?['Entity_x0020_ID']['Value'],'.',split(triggerBody()?['{FilenameWithExtension}'],'.')[1])

File Content field set to File Content dynamic content of the "Get file content" action.

 

Then add a "Delete file" action, specify Site Address and the File Identifier field set to Identifier dynamic content of the trigger.

 

Add a "Copy file" action, specify Site Address, Source File Path set to Path dynamic content of the trigger, Destination File Path field set to Folder path dynamic content of the trigger and the DisplayName dynamic content of the "Create file" action.

 

Add a "Delete file 2" action, specify Site Address and the File Identifier field set to Id dynamic content of the "Create file" action.

 

Image reference:27.JPG

 

28.JPGNote: The Entity ID column is a Lookup type column in my SharePoint library.

 

 

 

The flow works successfully as below:29.JPG

 

30.JPG

 

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
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

PytByt Post Prodigy
Post Prodigy

Re: How to rename a SharePoint file name upon upload in the document library using Microsoft Flow?

hi @v-xida-msft 

i want to try this, could you help out by explaining it more detail in step by step?

i mean, where do i start and how?

thanks.

pytbyt

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (7,040)