Simple HTTP request to rename a file in SharePoint with Power Automate

“Why can’t Power Automate rename a file in SharePoint in the same way it can rename a file in OneDrive? It’s one of the most basic operations!”

Power Automate is still missing an action that will allow you to rename a file in SharePoint. You can update all the file properties with the ‘Update file properties’ action, but file name is not one of them.

One solution I’ve seen is to ‘Copy file’ with a new name, and then delete the original one. It’ll achieve the goal, but it’ll create a new file with new ID, new link, and empty version history. I don’t think it’s a good solution.

Another, much better solution is to update the file name with an HTTP request. As already mentioned a few times on this blog, HTTP requests give you much more control. The limitations of the standard Power Automate actions don’t apply to HTTP requests, the only limitation for them is what the SharePoint REST API allows you to do. And it allows you to update the file name.

But even here I’ve seen complicated HTTP requests that I think are quite complex for most users.

The HTTP request doesn’t have to be as complicated, you don’t need a SharePoint consultant to create it for you.

Simple HTTP request

You can use the same HTTP request as when updating a single SharePoint column. If you define the update operation in the ‘Uri’, you don’t need all the headers. And if you use the right operation, you don’t even need such complicated ‘Body’. The request below is all you need to rename a file.

Method: POST

Uri: _api/web/lists/GetByTitle('<LibraryName>')/items(<DocumentID>)/validateUpdateListItem

	    "FieldName": "FileLeafRef",
	    "FieldValue": "<NewFileNameWithExtension>"

Why is the “FieldName”: “FileLeafRef” and not “Name”? As already explain in the article on searching files by their name, FileLeafRef represents the file name. It’s an internal column name that’s used in SharePoint for ages, even though it’s not visible anywhere in the properties. Just don’t forget to include also the file extension in the file name.

Power Automate rename file in SharePoint


Changing file name is a basic operation for every document storage, and it’s strange that Power Automate doesn’t have an action to rename files stored in SharePoint. But as already shown multiple times, there’s a workaround. And the workaround doesn’t have to be complicated, it can be a simple HTTP request. Simple, if you know the ‘Uri’, ‘Body’ and the internal name for the ‘Name’ property…

You can even update the file name without creating a new version of the document with a small addition to the request. But it might get a bit more complicated if you want to update content of an existing file, not just the file name.

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.


Add a Comment

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