Skip to content

Instantly share code, notes, and snippets.

@rheid
Created July 10, 2016 17:26
Show Gist options
  • Save rheid/592d5d3d6960d6b666d8d9fe8fee39b1 to your computer and use it in GitHub Desktop.
Save rheid/592d5d3d6960d6b666d8d9fe8fee39b1 to your computer and use it in GitHub Desktop.
SharePoint Change ListItem URL
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell;
}
$web = Get-SPWeb "http://YourWeb/sites/"
$list = $web.Lists["OLD Name"]
# Display the fields, so to make sure you are grabbing the correct list in the correct site collection
$list.Fields | sort StaticName,Type | ?{$_.CanBeDeleted -eq $true -and ´
$_.Hidden -eq $false} | FT Title,StaticName,Type
# Check the name name and destination before
# $list.RootFolder
$list.RootFolder.Name
$list.RootFolder.Url
$web.Lists["OLD Name"].RootFolder.MoveTo("/Lists/NEW Name")
# Check the name name and destination afterwards
$list.RootFolder.Name
$list.RootFolder.Url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment