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

We have Sharepoint 2007 with WCM enabled. We have several sites. And the Navigation Menu's shows the sites perfectly. So we are able to hide the sites in the Navigation Settings. All the menus will respect this.

My requirement is through code if i have the site name Will i be able to know whether this site is hidden in the Navigation or not?

share|improve this question

One would think that looking at the SPNavigationNode object there is an IsVisible property which should tell you whether the site is hidden in the navigation or not. But apparently that is not the case for publishing sites (WCM).

See this post which explains how to find out that info for a publishing site:

share|improve this answer
I will try this out-but it is unfortunate why it is not been part of SPWeb property – Thomson Aug 29 '11 at 17:08
SPWeb is for WSS and WCM is part of MOSS. Basically, MOSS is built on top of WSS just like you dev on top of WSS. So they can't add MOSS functionality to WSS objects, they have to have their own objects. Does that make sense? Thanks. – Steve Lineberry Aug 29 '11 at 17:43

If your web is publishing web,You can use PublishingWeb.IncludeInCurrentNavigation or PublishingWeb.IncludeInGlobalNavigation, depending on you want to check for current or global navigation.

Otherwise, you can use a simple function like below :

bool IsWebVisible(SPWeb webToCheck)

SPNavigationNode node= SPContext.Current.Site.RootWeb.TopNavigationBar.GetNodeByUrl(webToCheck.Url);

// or SPNavigationNode node= SPContext.Current.Site.RootWeb.GlobalNodes.GetNodeByUrl(webToCheck.Url);

// or SPNavigationNode node= SPContext.Current.Site.RootWeb.QuickLaunch.GetNodeByUrl(webToCheck.Url);

 return node.IsVisible;

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.