更新儿童使用PowerShell节点在SharePoint GUI

问题描述:

我试图更新使用PowerShell在我的SharePoint网站上的结题并不反映:如果我尝试第二次更新儿童使用PowerShell节点在SharePoint GUI

$web = Get-SPWeb "http://dev:18792/sites/devsite/" 

foreach ($webs in $web.Webs) 
{ 

$nodes = $webs.Navigation.QuickLaunch 
foreach ($node in $nodes) 
{ 
    $nodeTitle = $node.Title 
    if ($nodeTitle.ToString().Contains("First node")) 
    { 
     foreach ($nodeChild in $node.Children) { 

      $nodeChildTitle = $nodeChild.Title 

      if ($nodeChildTitle.ToString().Contains("Original childnode title")) { 

       $nodeChild.Title = "Changed title" 
       $nodeChild.Update() 
       Write-Host "done." 
      } 
     } 

    } 
    $webs.Dispose() 
} 
$web.Dispose() 
} 

,改变

.Contains("Original childnode title") 

到:

.Contains("Changed title") 

它输入if语句,但变化并不在GUI中可见。

我在这里错过了什么吗?

难道这可能是因为您的发布功能已激活?在发布网站上操作快速启动有点不同。下面是一些示例C#代码:

PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(oWeb); 
SPNavigationNodeCollection nodes = pubWeb.Navigation.CurrentNavigationNodes; 
foreach (SPNavigationNode node in nodes) 
{ 
    if (node.Title == "Original Title") 
    { 
     node.Title = "New Title"; 
     node.Update(); 
     break; 
    } 

}

否则尝试调用$ webs.Update()方法