Power Automate: Rename file in SharePoint Online

 




We often get to change the name of the file, so in this article, I will explain how to rename the file in SharePoint Online using Microsoft Power Automate.


Below is the file which I will be renaming.





Step 1: Get the file properties

We only need to have the SharePoint item id, for which we want to rename the file

Step 2: Update the File Name

Add the "Send an HTTP request to SharePoint" connector, and update the following properties
  • Method: POST
  • Uri: _api/web/lists/GetByTitle('<LIBRARY TITLE>')/items(<ITEM ID>)/ValidateUpdateListItem
  • Body:
{
    "formValues":[
        {
            "FieldName": "FileLeafRef",
            "FieldValue": "<New File Name>"
        }
    ]
}



Execute the flow, and the file will be renamed





Happy Automating..!!
#PowerAutomate #SharePointWidgets #Microsoft

Comments

  1. Hi, what is yout solution for a second document with the same name. I´m looking for an workaround to set the name to "Updated the name(2)" and "Updated the name(2)....

    ReplyDelete
  2. Thanks for that, really helped me out!

    ReplyDelete
  3. Thanks so much for the solution.

    ReplyDelete

Post a Comment

Popular posts from this blog

Rename Folder using Microsoft Flow / Power Automate in a Document Library in SharePoint Online

Power Automate: How to Add "New Line" to the text in SharePoint multiline text field