How To Easily Rename A SharePoint File With Power Automate

power automate rename file sharepoint

Unfortunately renaming a SharePoint file’s name with Power Automate is not directly supported by any of the SharePoint actions.

Therefore you’ll find in the web lots of tutorials, that copy the file to a new file with the new name and deleting the original file. This is a bad approach, since you are losing the file history this way. Furthermore this approach is unnecessary complex.

This guide explains how to rename a SharePoint file with one Power Automate action without creating a new file.

One Step Guide: Renaming a SharePoint file with Power Automate

Power Automate Rename SharePoint File Result

See a complete flow with the one step needed to rename a SharePoint file without creating a new file.

  1. Add a “Send an HTTP request to SharePoint” action and configure it as shown below

    Power Automate Rename SharePoint File

    Send an HTTP request to SharePoint does the renaming

  2. Check your file in SharePoint

    Power Automate Rename SharePoint File Result

    Renamed file

Reference for Copy & Paste

Uri

Here is the Uri, please replace the #ADJUST# placeholders.

_api/web/lists/GetByTitle('#ADJUST#')/items(#ADJUST#)/validateUpdateListItem

As an example, the exact Uri used in the example.

_api/web/lists/GetByTitle('Documents')/items(@{outputs('Get_file_metadata')?['body/ItemId']})/validateUpdateListItem

Body

Here is the Body, please replace the #ADJUST# placeholders.

{
    "formValues":[
	{
	    "FieldName": "FileLeafRef",
	    "FieldValue": "#ADJUST#"
	}
    ]
}

As an example, the exact Body used in the example.

{
    "formValues":[
	{
	    "FieldName": "FileLeafRef",
	    "FieldValue": "name-@{utcNow('yyyy-MM-dd')}.txt"
	}
    ]
}

2 thoughts on “How To Easily Rename A SharePoint File With Power Automate”

  1. Nice example, just remember that lower case “mm” means Minute in PA talk. This should be “MM” to reflect the month.

Leave a Comment

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