使用 PowerShell 在 SharePoint 快速启动中的特定节点上设置受众
Set audience on specific node in SharePoint quick launch with powershell
我正在使用脚本为 SharePoint 中的导航节点设置访问群体。当我设置组时没问题,或者它设置了组但设置永远不会被推送。但是,如果我在 GUI 中编辑节点并按下确定(在节点设置和导航设置上),更改就会生效。
脚本:
$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()
}
我是不是在错误的地方使用了更新?
编辑:"SharePoint Server Publishing Infrastructure" 功能 已在网站集上激活。
通过添加 ;;;; 解决了它在群组名称之前。
$node.Properties["Audience"] = ";;;;Custom group"
我正在使用脚本为 SharePoint 中的导航节点设置访问群体。当我设置组时没问题,或者它设置了组但设置永远不会被推送。但是,如果我在 GUI 中编辑节点并按下确定(在节点设置和导航设置上),更改就会生效。
脚本:
$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()
}
我是不是在错误的地方使用了更新?
编辑:"SharePoint Server Publishing Infrastructure" 功能 已在网站集上激活。
通过添加 ;;;; 解决了它在群组名称之前。
$node.Properties["Audience"] = ";;;;Custom group"