How to Add/Update OOB Navigation Item Target Audience using Rest API/PNP JS in SharePoint Online

Copper Contributor

Hi,

 

I want to update/add Navigation Item in OOB Navigation with Target Audience and Open in New Tab using Rest API/PNP JS in SharePoint Online Modern. Please guild me on this.

 

DJoshi2302_0-1668762742237.png

 

Thanks in advance 

 

1 Reply

See the last 2 comments in this link below. It's supposed to be possible via PnP PowerShell but the code doesn't work. The code applies the audiences but when you view the SharePoint site they have no effect. If you edit the menu via the SharePoint UI and change the title of a menu item and then click save the audiences will work. Something is not being saved correctly when running the PnP PowerShell code.

 

I've also posted a bug report on their GitHub page but got no response after several months. Let me know if you find a solution

https://techcommunity.microsoft.com/t5/sharepoint/set-audiences-to-target-in-sharepoint-navigation-u...

 

https://github.com/pnp/powershell/discussions/2392