Categories: Microsoft 365

Rename SharePoint folders using Power Automate in 2 easy steps

Have you ever wanted to rename SharePoint folders with Power Automate?

REST API call to use

According to the documentation the following two calls are needed to rename SharePoint folders.

The first call is to collect the odata type and the etag for the folder. The OData Type tells our REST API calls something about the shape of our data in our list. The etag identifies the document or in our case our folder that we want to update.

GET https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/ListItemAllFields
 Authorization: "Bearer " + accessToken
 Accept: "application/json;odata=verbose"

The second REST API call is used to do the actual update and to rename our SharePoint folder.

POST https://{site_url}/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/ListItemAllFields 

Authorization: "Bearer " + accessToken 
Accept: "application/json;odata=verbose" Content-Type: "application/json" 
Content-Length: {length of request body as integer} 
If-Match: "{etag or *}" 
X-HTTP-Method: "MERGE" 
X-RequestDigest: "{form_digest_value}" 

  "__metadata": {
     "type": "{odata.type from previous call}"   
   "Title": "New name",
   "FileLeafRef": "New name"

Ok, that looks complicated!

Folder in SharePoint

In my document library in SharePoint, I’ve got a folder called testfolder.

This is the folder that I want to rename to a new name.

Send an HTTP request to SharePoint to get the OData.type and ETag

Time to have a look at how we call these REST API calls in Power Automate.

We will start with a Send an HTTP request to SharePoint action and then I’m adding two compose actions. These compose action aren’t really needed. But when we look at the Flow run they make it just that little bit easier to understand our data.

In the above Send an HTTP request to SharePoint action Uri is set to include the SERVER relative url.

_api/web/GetFolderByServerRelativeUrl('/Shared Documents/testfolder')/ListItemAllFields

So if you happen to rename a folder in a site collection that isn’t your root site collection then you will need to include that part of the url too as shown below.

/sites/anysite/_api/web/GetFolderByServerRelativeUrl('/sites/anysite/Shared Documents/testfolder')/ListItemAllFields

The above compose actions collect the Type and the Etag with the following two expressions. For the Type this will be the following 1 liner


and for etag the following expression will do the job


Now we can look at renaming our SharePoint folder with yet another Send an HTTP request to SharePoint.

Rename SharePoint folder

Now the final step of our flow to rename SharePoint folders using Power Automate. A Send an HTTP request to SharePoint. For more information about this action please see my user guide about using the SharePoint REST API

The Uri in the above action is set to

_api/web/GetFolderByServerRelativeUrl('/Shared Documents/testfolder')/ListItemAllFields

The body of the REST API to rename SharePoint folders is set to

   "_metadata": {     "type": "@{outputs('_Compose-_Type')}"
 "Title": "New Name",
 "FileLeafRef": "newname"

In this example I’m going to set the Title and the FileLeafRef to a different value so that later on it is clearer to see what goes where. Quite often you might want to make these match.

Running the Power Automate flow

The first step in the flow is now collecting the etag and the type. Notice that the type will be different for every document library. But for every document library it will be the same. So you could even skip the first few steps and hard code the type if you really wanted to.

Then the last step is now setting the Title and the name of the folder to the values that we want. the internal name of the Name field is FileLeafRef and that will be what we will need to use to compete our Power Automate flow.

As the flow is successful, we would hope that the folders have been renamed. Time to have a look back in SharePoint.

The Result

Now my folder in SharePoint has been renamed to newname.

And the title has been set to New Name

And our mission to rename SharePoint folders has succeeded.

Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using

Recent Posts

Filter Query in SharePoint Get Items in Power Automate

Have you tried the experimental version of Filter query in the SharePoint Get Items action…

2 days ago

3 Ways to add a column to an array in Power Automate

When you have an array in Power Automate and you would like to add a…

6 days ago

Patch any field type in a SharePoint list item using Power Apps

In Power Apps the Patch function is very important when you work with data. In…

1 week ago

Call flows from a model driven app

Wouldn't it be great if you could call flows from a model driven app? Well…

2 weeks ago

Variables or Compose? Consider neither in Power Automate

The question is Variables or Compose actions in Power Automate? Variables Sometimes you need a…

2 weeks ago

Your 1st lesson in Power Apps, in a few easy steps!

1st lessons can be so important when you want to get started with Power apps.…

4 weeks ago