[英]Set audience on specific node in SharePoint quick launch with powershell
I'm using a script for setting an audience group for a navigation node in SharePoint. 我正在使用脚本为SharePoint中的导航节点设置受众群体。 When I set the group It's no problem, or it sets the group but the settings is never pushed through. 当我设置组时,这没问题,或者它设置了组,但是设置从未完成。 But If I edit the node in the GUI and just press OK (on both the node settings and navigation settings) the changes goes through. 但是,如果我在GUI中编辑节点并仅按OK(在节点设置和导航设置上),更改就会通过。
Script: 脚本:
$FindString = "Custom link"
Get-SPSite "http://dev:18792/sites/devsite/" | Get-SPWeb -Limit ALL | ForEach-Object {
$web = $_
$_.Navigation.QuickLaunch | ForEach-Object {
$_.Children | ForEach-Object {
if($_.title -eq $FindString){
$node = $_
$node.Properties["Audience"] = "Custom group"
$node.Update()
}
}
}
$web.Update()
}
Am I using the Updates in the wrong place? 我在错误的地方使用更新吗?
EDIT: "SharePoint Server Publishing Infrastructure" feature is activated on the site collection. 编辑:网站集上已激活 “ SharePoint Server发布基础结构”功能。
Solved it by adding ;;;; 通过添加;;;;解决 before the group name. 组名之前。
$node.Properties["Audience"] = ";;;;Custom group"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.