Hi All,
Got a new requirment to change quick launch links of the a website.
Below is powershell for it.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$FindString="url you want to update comes here"
$ReplaceString="new url here"
$SPWeb = Get-SPWeb "http://dev-test/" ## website url here
$SPWeb.Navigation.QuickLaunch | ForEach-Object {
if($_.Url -match $FindString){
$linkUrl = $_.Url
Write-Host "Updating $linkUrl with new URL"
$_.Url = $_.Url.Replace($FindString,$ReplaceString)
$_.Update()
}
$_.Children | ForEach-Object {
if($_.Url -match $FindString){
$linkUrl = $_.Url
Write-Host "Updating $linkUrl with new URL"
$_.Url = $_.Url.Replace($FindString,$ReplaceString)
$_.Update()
}
}
}
$SPWeb.Dispose()
Got a new requirment to change quick launch links of the a website.
Below is powershell for it.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$FindString="url you want to update comes here"
$ReplaceString="new url here"
$SPWeb = Get-SPWeb "http://dev-test/" ## website url here
$SPWeb.Navigation.QuickLaunch | ForEach-Object {
if($_.Url -match $FindString){
$linkUrl = $_.Url
Write-Host "Updating $linkUrl with new URL"
$_.Url = $_.Url.Replace($FindString,$ReplaceString)
$_.Update()
}
$_.Children | ForEach-Object {
if($_.Url -match $FindString){
$linkUrl = $_.Url
Write-Host "Updating $linkUrl with new URL"
$_.Url = $_.Url.Replace($FindString,$ReplaceString)
$_.Update()
}
}
}
$SPWeb.Dispose()
No comments:
Post a Comment