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

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

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

share|improve this answer

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.