Thursday, May 5, 2016

Rename a List or Library in SharePoint 2013 with Powershell

Don't save the List or Library as a template, then restore it.  Use Powershell instead!

add-pssnapin microsoft.sharepoint.powershell

$libOriginalUrl = "/Lists/OldListURL/";
$libNewUrl = "/Lists/NewListURL";
$web = Get-SPWeb -Identity http://somesite.com/sites/teamsite

$lib = $web.GetList($web.Url + $libOriginalUrl)
$rootFolder = $lib.RootFolder;
$rootFolder.MoveTo($web.Url + $libNewUrl)

No comments:

Post a Comment