Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have create a Publishing site collection in Sharepoint 2007 and when i try to get the TopNavigation Bar for 'Report Centre' site I get it null.

Why ? However for Document Centre,News etc it is not null. Can someone explain me ?

string siteUrl = "http://sp07:9988/sites/testpubsite/Reports";
using (SPSite site = new SPSite(siteUrl))
{
    SPWeb web = site.OpenWeb();
    var topBar = web.Navigation.TopNavigationBar;
}
share|improve this question

1 Answer 1

Simply because it might be that your Top Link bar is INHERITED from its parent. Check also for the UseShared if its TRUE then the reference shall always be NULL.

See here http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.navigation.spnavigation.topnavigationbar.aspx

share|improve this answer

Your Answer

 
discard

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.