cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tism
Level: Powered On

Renaming a SharePoint Folder or Document Set

Hi all,

 

Does anyone know of a way that a SharePoint folder and/or document set can be renamed through Flow?  There doesn't seem to be anything obvious through the SharePoint actions that are available.

 

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
tism
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

@v-yamao-msft  thanks for this, have posted a new idea here: https://powerusers.microsoft.com/t5/Flow-Ideas/New-SharePoint-Action-rename-file-folder-document-set...

 

In the meantime, for anyone else that needs to rename a folder or document set in Flow, as @v-yamao-msft  mentioned you need to use the SharePoint API via the "Send an HTTP request to SharePoint" action, like this:

 

RenameDocumentSet.PNGRenaming a document set   

 

In the above example, "Name" is the name of the existing document set, and "ProjectName" is the new name.  "Business Case Requests" is the name of the document library that contains the Document Set.  I can confirm the above works for Document Sets, haven't tried it on a folder yet.  

 

Hopefully some more basic SharePoint actions get added to flow soon, it took me a while to get this right, and for information workers who wouldn't have a clue as to how to leverage the SharePoint API, basic SharePoint operations like this will be difficult for them to achieve!

View solution in original post

9 REPLIES 9
Highlighted
Community Support Team
Community Support Team

Re: Renaming a SharePoint Folder or Document Set

Hi @tism,

 

We do not have a direct action can be used to rename folder and document set in SharePoint library. If you need this feature, please consider submitting a request on Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

However, if you are familiar with Rest APIs, you could try to create a custom connector to achieve it. Please check the following for a reference:

Update folder name using REST API

Custom connectors in Microsoft Flow

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tism
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

@v-yamao-msft  thanks for this, have posted a new idea here: https://powerusers.microsoft.com/t5/Flow-Ideas/New-SharePoint-Action-rename-file-folder-document-set...

 

In the meantime, for anyone else that needs to rename a folder or document set in Flow, as @v-yamao-msft  mentioned you need to use the SharePoint API via the "Send an HTTP request to SharePoint" action, like this:

 

RenameDocumentSet.PNGRenaming a document set   

 

In the above example, "Name" is the name of the existing document set, and "ProjectName" is the new name.  "Business Case Requests" is the name of the document library that contains the Document Set.  I can confirm the above works for Document Sets, haven't tried it on a folder yet.  

 

Hopefully some more basic SharePoint actions get added to flow soon, it took me a while to get this right, and for information workers who wouldn't have a clue as to how to leverage the SharePoint API, basic SharePoint operations like this will be difficult for them to achieve!

View solution in original post

ryan2k
Level 8

Re: Renaming a SharePoint Folder or Document Set

@tism

Thanks for the workaround! Hard to believe such a basic task requires the API connector... I'm trying to rename a simple Folder, but am having a hard time tweaking it just right. I've shared it here: https://powerusers.microsoft.com/t5/Using-Flows/Copy-and-Rename-a-SharePoint-Folder/m-p/167932

 

The Properties for the Folder are a bit different than the Document Set and I feel like I've set it up as it should be, using the 'name' propery, but it doesn't seem to like that. Any thoughts?

FinTechPKOBP
Level: Power Up

Re: Renaming a SharePoint Folder or Document Set

Hi! I have tried this solution and got the following error message "Server relative urls must start with SPWeb.ServerRelativeUrl". What I am missing?

JessEIeng
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

@tism Thanks for your post! It has helped me the most of any other along this topic. In fact, following your example allowed me to get the flow to run successfully for the first time! Woohoo!

 

There is one exception though, It didn't actually rename the file. When I looked at my document list the file had the same name as the previous one though the last part was incremented up by 1.  Overall, I'm trying to achieve the following:

Enter/Update/View information via PowerApps

Create SP List item when new PA form is submitted

Create a Word document by entering Properties into Word Template

Convert said Word document to PDF

Email Document as email body and attach PDF

 

So far, I've got everything to FINALLY run successfully with the exception of not renaming my word template when the properties are updated. I managed to give the PDF the Project Name property as it's file name but am struggling with doing the same for the new word document.  

HTTP Flow.JPG

 

Any insights you might have to help me change the file name would be great!

blinduvlad
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

No it doesn't work. I've banging my head for hours. No luck.

I get: Microsoft.SharePoint.Client.InvalidClientQueryException

Visuary1
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

I was receiving this error when attempting to rename a document set.  

An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected.
 
Here's how I got it to work:
Annotation 2019-04-19 054711.png
 
 
Visuary1
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

@JessEleng

I know this is old, did you ever figure it out?  I noticed you have a GET instead of a POST

 


@JessEIeng wrote:

@tism Thanks for your post! It has helped me the most of any other along this topic. In fact, following your example allowed me to get the flow to run successfully for the first time! Woohoo!

 

There is one exception though, It didn't actually rename the file. When I looked at my document list the file had the same name as the previous one though the last part was incremented up by 1.  Overall, I'm trying to achieve the following:

Enter/Update/View information via PowerApps

Create SP List item when new PA form is submitted

Create a Word document by entering Properties into Word Template

Convert said Word document to PDF

Email Document as email body and attach PDF

 

So far, I've got everything to FINALLY run successfully with the exception of not renaming my word template when the properties are updated. I managed to give the PDF the Project Name property as it's file name but am struggling with doing the same for the new word document.  

HTTP Flow.JPG

 

Any insights you might have to help me change the file name would be great!


 

 

andeeh1974
Level: Powered On

Re: Renaming a SharePoint Folder or Document Set

@tism  @Visuary1  @blinduvlad  @JessEIeng  @FinTechPKOBP 

 

Can I use this method to rename a folder using a list as my new file name? 

For example, I have several hundred folders in a library.  Each folder is currently named a name, "Bugs Bunny".  I have a list with columns "FullName" = "Bugs Bunny" and "EmpID" = "12345".  I want to rename "Bugs Bunny" to the EmpID value of "12345".  

I've messed around with this example to do this but I am not getting the results I need.  

Any help would be greatly appreciated!!

 

Andee

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 111 members 5,285 guests
Please welcome our newest community members: