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
    Replies
    1. Hi @Sumit ,
      I am trying to run the flow exactly as above but it keeps mentioning that URI error of 401 that input string is incorrect as I am extracting the zip file in the folder and then renaming it and then moving the file. Can you please suggest what can i follow to get rid of errors.

      Delete
    2. Hi, How do I determine the path if I don't want to change a file in the Documents folder but in other subfolders?

      Delete
    3. It is referring the file based on the item id

      Delete

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