cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Collector
Kudo Collector

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
Highlighted
Kudo Collector
Kudo Collector

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:

 

Renaming a document setRenaming 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

10 REPLIES 10
Highlighted
Community Support
Community Support

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.
Highlighted
Kudo Collector
Kudo Collector

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:

 

Renaming a document setRenaming 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

Highlighted
Resolver I
Resolver I

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?

Highlighted
New Member

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?

Highlighted
Frequent Visitor

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!

Highlighted
Regular Visitor

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

Highlighted
Advocate I
Advocate I

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
 
 
Highlighted
Advocate I
Advocate I

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!


 

 

Highlighted
Frequent Visitor

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

Highlighted
Helper I
Helper I

Re: Renaming a SharePoint Folder or Document Set

Old post but I recently encountered the same issue and resolved it by using the follow string for the document set path:

 

This did not work: LibraryName/DocSet
This DID work: /sites/ParentSite/SubSite/LibraryName/DocSet

 

This works for folders and document sets.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (7,742)