Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to read TopNavigationBar of a site using below code,

using (SPSite Site = new SPSite(URL))
  {
         using (SPWeb _web = Site.OpenWeb())
         {
           foreach (SPNavigationNode cNode in  _web.Navigation.TopNavigationBar)
           { string title =cNode.Title;
            }
         }
  }

this code is able to read all the node after following below steps manully only, but without performing these steps not able to read anything.

Goto Site Action -> Look and Feel -> Navigation -> Current Navigation Then click on Add link and save, but i am having around 50 sites and its dificult to do this manualy. Please suggest some solution

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.