使用PowerShell为所有子网站将InheritGlobal设置为true时,SharePoint 2013不会反映更改

时间:2014-02-10 11:36:29

标签: sharepoint powershell

我正在尝试将所有子站点设置为使用PowerShell脚本继承父导航,因为我有100个子站点。运行PowerShell脚本后,即使现在选中“显示与父级相同的导航”的导航设置,SharePoint 2013子站点也不会反映更改。该设置似乎已更新,但未应用。

我正在运行的PowerShell脚本是:

# get a sitecollection object(SPSite)
$SPSite = Get-SPSite -Identity "http://intranet/pm"

# loop through all the subwebs(SPWebs) in the site collection
foreach ($SPWeb in $SPSite.AllWebs)
{
   # check so that this is not the root web
  if (!$SPWeb.IsRootWeb)
  {

     # Save AllowUnsafeUpdates setting and set it to allow.
     $AllowUnsafeUpdatesStatus = $SPWeb.AllowUnsafeUpdates
     $SPWeb.AllowUnsafeUpdates = $true

     # Get a PublishingWeb object for the current web
     $SPPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($SPWeb)

     #Current Navigation Settings
     $SPPubWeb.Navigation.InheritGlobal = $true
     $SPPubWeb.Update()

     # cleanup 
     # Set AllowUnsafeUpdates back to original value
     $SPWeb.AllowUnsafeUpdates = $AllowUnsafeUpdatesStatus

     Write-Host -ForegroundColor Green $SPWeb.Url.ToString()  " - Done"

     $SPWeb.Dispose()
 }

 # cleanup
 $SPSite.Dispose()

任何帮助将不胜感激。

此致

Mugilan

1 个答案:

答案 0 :(得分:0)

请检查是否在网站集级别激活 SharePoint Server发布基础结构,并检查是否同时使用"全局导航"和"当前导航"部分检查。