Friday, October 18, 2013

How to Rename SharePoint Folder Programmatically

To rename a folder in SharePoint 2010, Navigate to the library where the folder exists. Click on "Edit Properties"

how to rename a sharepoint folder

Provide new name to the folder and click on "Save" button.
sharepoint 2010 rename folder programmatically

How rename SharePoint folder programmatically? 
To rename a folder in SharePoint document library programmatically, using C# object model code:
FolderPath = "http://YOUR-SharePoint-Site/sites/sales/documents/Invoices";

SPFolder TargetFolder = SPContext.Current.Web.GetFolder(FolderPath);

Target.Item["Name"] = "Invoices 2014";


Rename SharePoint Folder using PowerShell script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get the Web
$Web = Get-SPWeb ""

#New Name for the Folder
$NewFolderName = "Icons";

#Get the Folder to Rename by its path
$folder = $Web.GetFolder("");

if ($folder.Exists)
 #Set the New Name and Update
 $folder.Item["Name"] = $NewFolderName;

This code renames folder at given path. Unlike Lists & document libraries, Folder URLs will change when you give a new name to it. 

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

1 comment :

  1. how change folder field "TEAM" value "team 1" same and subfolder if folder name is like ABC


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...