SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can i add the new link as well as set the audience in currentNavSiteMapProvider in SharePoint Publishing using SharePoint Object Model.

share|improve this question
up vote 2 down vote accepted

I have used this method

public void SetNavigation()
        using (SPSite Site = new SPSite("http://YourWeb"))
        using (SPWeb Web = Site.OpenWeb())
            SPNavigationNode navNode = Web.Navigation.GlobalNodes[0];

            if (navNode.Properties.Contains("Audience"))
                navNode.Properties["Audience"] = ";;;;YourSiteMembers,YourSiteOwners";
                navNode.Properties.Add("Audience", ";;;;YourSiteMembers,YourSiteOwners");
share|improve this answer
Thanks @David, I just wanted to confirm that I wanted to add the links in Current navigation not in GlobalNodes. Is this code work for SharePoint Current navigation. – Basant B. Pandey Apr 27 '11 at 14:48
Global and current work the same as far as I know. I have used this for current as well. – David Palfery Apr 27 '11 at 15:03
I test the above code but I am unable to get the values audience properties. FYI I am getting the properties like "vti_nonnavpage" ect. – Basant B. Pandey Apr 27 '11 at 17:17
Sorry forgot the update line. Added navNode.Update() – David Palfery Apr 27 '11 at 19:34
Did this solve your issue? if so would you mind marking it as answered? – David Palfery Apr 28 '11 at 20:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.