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