Forum Discussion

DJoshi2302's avatar
DJoshi2302
Brass Contributor
Nov 18, 2022

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

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.

 

 

Thanks in advance 

 

1 Reply

  • kbeeveer46's avatar
    kbeeveer46
    Tin Contributor

    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-using/m-p/3652975#M65078

     

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