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

Highlighted
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
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.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (6,299)