Skip to content
True Rows
True Rows

Data | Apps | Flows

  • Data
  • Apps
  • Flows
True Rows

Data | Apps | Flows

Rename File in SharePoint Library with Power Automate

Vijaya Bhaskar, April 26, 2024

While I am trying to create an export to excel flow, I found out that we don’t have a direct action to rename a file in SharePoint document library. So lets rename a file using SharePoint HTTP Request action.

Above, we can see a pdf file in Documents library named as Orange.pdf. Now, lets rename this file to Green.pdf

We would be using “Send an HTTP request to SharePoint” action to achieve this.

Lets understand the parameters

Site Address: <Select your site>
Method: POST
Uri: _api/lists/GetByTitle('<Library Name>')/Items(<Item ID>)

I have hardcoded the item ID in the action, whereas we can get the item ID from relevant previous actions.

Headers:
Content-type: application/json;odata=verbose
IF-MATCH: *
X-HTTP-METHOD: PATCH
Body:
{'__metadata':
{'type':'SP.Data.Shared_x0020_DocumentsItem'},
'FileLeafRef':'Green'}

Above are the two crucial parameters for this action. Lets try to understand them

Firstly, “FileLeafRef” is the parameter where we want to give new file name which in our case is “Green”

Secondly, “type” which is a little complex.

{‘type’:’SP.Data.Shared_x0020_DocumentsItem’} — For ‘type’ we can get the value by following format
SP.Data.<DocumentLibraryInternalName>Item

Few examples for better understanding:

External name: Documents
Internal name: Shared Documents
Then the value would be SP.Data.Shared_x0020_DocumentsItem (Space is replaced with “_x0020_”)

External name: InvoicesDocs
Internal name: InvoicesDocs
Then the value would be SP.Data.InvoicesDocsItem

Also alternatively, we can use the GET method of SharePoint HTTP Action to get the above value.

When we use this action, the type would be

Body:
{'__metadata':
{'type':'@{outputs('HTTP_request_to_SharePoint_to_find_type')?['body']?['d']?['ListItemEntityTypeFullName']}'},
'FileLeafRef':'Green'}

Let me know if you need any help in the comments.

Flows Power Automate

Post navigation

Next post

Related Posts

Updating Multiple-Person Fields in Power Automate Made Simple

December 14, 2024December 14, 2024

Problem Statement: When updating a multiple-person or group field in Power Automate, it often causes issues. Instead of updating all the people in the field, it creates multiple records—one for each person—resulting in duplicates or incomplete updates. Solution: To effectively update a multiple-person field in Power Automate, we start by…

Read More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Updating Multiple-Person Fields in Power Automate Made Simple
  • Rename File in SharePoint Library with Power Automate

Recent Comments

No comments to show.

Archives

  • December 2024
  • April 2024

Categories

  • Blog
  • Flows
Email
The form has been submitted successfully!
There has been some error while submitting the form. Please verify all form fields again.
©2025 True Rows | WordPress Theme by SuperbThemes