Die deutschsprachige Community für SharePoint, Microsoft 365, Teams, Yammer und mit Azure
SharePoint - Set Target Audience to Navigation Nodes by code


Oliver Wirkus



Web 2.0



 Add to Technorati Favorites


 Delicious Bookmark this on Delicious


  Locations of visitors to this page


This post is a follow-up to my previous post. After I have created the QuickLaunch headings I needed to add Target Audiences to some of these navigation headings. To do this I have created the following code snippet:


This code adds a SharePoint group (referred to by its title) as a Target Audience to a SPNavigationNode object and if the property ‘Audience’ does not exist, it is created. This code works fine, but there are two things that needs to be remembered. If this method is called like this …


… the group is added as a Target Audience, but in most cases this value is not verified (see the next screenshot).  If more than one group should be used as Target Audience, these groups cannot be concatenated like this: “Approvers;Designers”.


When setting a Target Audience to a SPNavigationNode, it is most likely that the Target Audience should be added as a verified value. To add a SharePoint group as a Target Audience to a SPNavigationNode  a special string format needs to be used. This string format looks like this:


If a SharePoint group should be used as an audience, the string needs to look like this ;;;;myGroup. If two or more groups should be added as audiences, the string should look like this: ;;;;Approvers,Designers. Very important: in both cases use 4 leading semicolons and separate each group by a comma! Unfortunately there are some blog posts out there that state to use semicolons to separate groups instead. I can’t confirm that! Groups that are used as audiences need to be separated by a comma!

Add to Technorati Favorites Folge mir auf Twitter FourSquareLogo

Bereitgestellt 20 Feb 2013 16:23 von Oliver Wirkus
Gespeichert unter: ,