Microsoft Flow - Renaming Files in SharePoint Online using Flow

So your looking to use Flow and rename some files in SharePoint.

Too easy, but wait - there are no actions available to allow a rename? So what's next!?

Well here we go, REST API to the rescue! But not so fast, there are some catches.

You create a "Sent an HTTP request to SharePoint" action and fill in the properties as follows

Site Address =
Uri = _api/web/lists/getbytitle('<LIST NAME>')/getItemByStringId('<List Item ID>')
Headers =
"X-HTTP-Method": "PATCH",
"If-Match": "*",
"Content-Type": "application/json;odata=verbose",
"Accept": "application/json;odata=verbose"
Body =
{'__metadata': {'type': 'SP.Data.Project_x0020_DocumentsItem'}, 'Title':'test', 'FileLeafRef':'test.bmp'}

The above can be created in the activity pretty much like for like.

But you will need to confirm your 'type' specific to your list as generated by SharePoint.

The best way to do this is to download the json file generated by a 'get'.

Basically create an item in your list or library, then access it with a browser to download the JSON file e.g.'<LIST NAME>')/getItemByStringId('<List Item ID>')

Make sure that the List Item ID is for a file you uploaded (you can modify the list view to show the ID column).

Once you download your JSON file open it up in notepad or VIM and search for "SP.Data" you will find the correct name of your type - this is required to update the list item or document correctly.

That's it! Rename your documents using flow.


  1. This is a great article with lots of informative resources. I appreciate your work this is really helpful for everyone. Check out our website Google Search Api for more related info!


Post a Comment

Popular posts from this blog

Change Password in Windows Server 2012

SharePoint Set Locale Region on All Web Applications and Site Collections