Created
July 10, 2016 17:26
-
-
Save rheid/592d5d3d6960d6b666d8d9fe8fee39b1 to your computer and use it in GitHub Desktop.
SharePoint Change ListItem URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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