Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

How to Rename SharePoint Folder Programmatically

$
0
0
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, use this PowerShell script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get the Web
$Web = Get-SPWeb "http://sharepoint.crescent.com/sites/branding/"

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

#Get the Folder to Rename by its path
$folder = $Web.GetFolder("http://sharepoint.crescent.com/sites/branding/DesignDocuments/Symbols");

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

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

Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>