我是SharePoint新手,需要帮助来更新Sharepoint网站中的URL。有人建议更新Powershell会更好,还是可以接受其他建议。谢谢
答案 0 :(得分:1)
以下PowerShell供您参考。
$siteURL="http://sp2013/sites/team"
$termStoreName="Managed Metadata Service"
$termGroupName="Global Navigation"
$termSetName="MyTermSet"
$oldUrl="/test"
$newUrl="/test1"
$site = Get-SPSite -Identity $siteURL
$taxSession = Get-SPTaxonomySession -Site $site
$tStore = $taxSession.TermStores[$termStoreName]
$tGroup = $tStore.Groups| Where-Object {$_.Name -eq $termGroupName}
$tSet = $tGroup.TermSets| Where-Object {$_.Name -eq $termSetName}
foreach( $term in $tSet.Terms)
{
$term.Name
$NavURL = $term.LocalCustomProperties["_Sys_Nav_SimpleLinkUrl"]
if($NavURL -match $oldUrl)
{
$NavURL = $NavURL -replace $oldUrl, $newUrl
$term.SetLocalCustomProperty("_Sys_Nav_SimpleLinkUrl",$NavURL)
}
$term.LocalCustomProperties["_Sys_Nav_SimpleLinkUrl"]
foreach ( $subTerm in $term.Terms)
{
$subTerm.Name
$NavURL = $subTerm.LocalCustomProperties["_Sys_Nav_SimpleLinkUrl"]
if($NavURL -match $oldUrl)
{
$NavURL = $NavURL -replace $oldUrl, $newUrl
$subTerm.SetLocalCustomProperty("_Sys_Nav_SimpleLinkUrl",$NavURL)
}
$subTerm.LocalCustomProperties["_Sys_Nav_SimpleLinkUrl"]
}
}
$tStore.CommitAll()
引用:SharePoint 2013 Managed Metadata Navigation with Site collection relative URLs