cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yin2021
Regular Visitor

rename sharepoint file

 

I am trying to create a Flow that will automatically rename a file when it is uploaded to my SharePoint with the folder name: running number + File name

I can't seem to find a thread that is doing this, any advice would help.

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User II
Super User II

Hi @Yin2021,

 

In my flow I have added an additional action called Initialize variable. That variable is of type string and called LibraryName. I using the name of the library as a value, in my example SourceLibraryName. You can replace that by your library name.

 

libraryname.png

View solution in original post

3 REPLIES 3
Expiscornovus
Super User II
Super User II

Hi @Yin2021,

 

You could use a Send an HTTP request to SharePoint action an use the FileLeafRef field.

 

1. Add a When a file is created (properties only) action.

2. Add a Send an HTTP request to SharePoint action. Use the following configuration. Use the ID of the when a file is created action

 

URI

 

_api/web/lists/getByTitle('@{variables('LibraryName')}')/items(@{triggerOutputs()?['body/ID']})

 

 

Headers

 

{
  "Content-Type": "application/json;odata=nometadata",
  "X-HTTP-Method": "MERGE",
  "If-Match": "*"
}

 

 

Body

 

{ 'FileLeafRef': '01234-@{triggerOutputs()?['body/{Name}']}'}

 

 

renamefile_sendahttp.png 

Hi @Expiscornovus,

Thanks for your quick reply. but i am still new to Power automate. I try your flow but it pops out the error message. Do you mean i need to set the variable for my file name? 

Thanks. 

 

Yin2021_0-1614658337463.png

 

Expiscornovus
Super User II
Super User II

Hi @Yin2021,

 

In my flow I have added an additional action called Initialize variable. That variable is of type string and called LibraryName. I using the name of the library as a value, in my example SourceLibraryName. You can replace that by your library name.

 

libraryname.png

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

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

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (106,771)