Forum Discussion
johndpalm
Dec 15, 2020Brass Contributor
Set 'audiences to target' in SharePoint navigation using PowerShell
I'm using PnP PowerShell to create SharePoint Hub navigation nodes (Add-PnPNavigationNode), but cannot find a way to configure the audience targeting via PowerShell. I tried this. It completed w...
thaBo77
Apr 07, 2022Copper Contributor
AudienceIds are a list of GUIDs, so try this one:
$audienceList = New-Object System.Collections.Generic.List[guid]
$audienceList.add([System.guid]::New(("YOURGROUPID")))
$node.AudienceIds = $audienceList
$node.Update()
Invoke-PnPQuery
kbeeveer46
Oct 13, 2022Copper Contributor
I tried your code and when I view the SharePoint site I can see that it added the audience to my QuickLaunch link but it doesn't seem to have any affect. I added an audience (office 365 group that I am not a part of) to the link but I can still see the link.
Here is an example of what I'm referring to. I'm not part of this audience but the DMA Support link is still visible to me. When I add the audience manually through the SharePoint UI it works fine. The link is hidden from me. It just doesn't work when I do it from PnP PowerShell.