Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Global Navigation

  Asked By: Josue    Date: Apr 19    Category: Sharepoint    Views: 1761

I am a developer who has just finished the Mindsharp SharePoint
Development Training course. It was an excellent course, and I am
getting into doing some SharePoint development for my company. I have
one question that was not addressed by the class, that I was hoping to
get answered.

We are using Sharepoint for our company's intranet. We are doing some
heavy branding and customizations. One of the main customizations we
want to do to our site is to have a global navigation. Our Farm is
split up into about 10 web applications, and each web application is
running one site collection under it. There is a site collection
called "home," which is going to be the main access point for our
site. The other site collections correspond to different business
areas in our company - marketing, IT, PSO, etc.

"Home" has a navigation bar at the top with Drop Down menus. It is
astandard sharepoint menu, which style customizations. It looks
something like this: http://goluphi.googlepages.com/home.jpg

What we want to do is to have the navigation from the home page
globally displayed across all sites in all site collections. I would
like this to be dynamically generated and update, without having to
manually update an XML file. So, I decided to go about doing it in a
web part, and getting a handle for the home site collection, and using
that to get the navigation.

The problem I am having is that I am able to get the "home" site
collection from a different site collection, and I am able to get the
info for the main navigation, but I am unable to get the
names/navigation of any of the items in the drop down menus. I am able
to get the other SPWebs that would appear under the drop down menu,
but the drop down menu is composed of links to the other site
collection, and SPWebs, so the links don't show up.

Here is my code so far, and the results.


protected override void RenderContents(HtmlTextWriter writer)
SPFarm spf = SPFarm.Local;
SPWebService spws =

foreach (SPWebApplication spwa in spws.WebApplications)
bool homeFound = false;
writer.Write("Web app name: " + spwa.Name + " ");
SPWebApplication webApplication = spwa;
SPSiteCollection siteCollections =

foreach (SPSite siteCollection in siteCollections)

writer.Write("" + siteCollection.Url +

SPWeb mySite = siteCollection.RootWeb;

PublishingWeb rootWeb =

foreach (SPNavigationNode node in

writer.Write("Node title: " + node.Title +
" Node url: " + node.Url +
"Global node count: "+
node.Navigation.GlobalNodes .Count +


homeFound = true;


if (homeFound)
catch (Exception error)


And here are the results for the home site collection:
Web app name: Development Enterprise Portal http://home.mycompany.com
Node title: Company Node url: /company
Node title: Employee Services Node url: /corporate
Node title: Search Node url: /Search
Node title: Sales Node url: http://sales.home.mycompany.com
Node title: Marketing Node url: http://marketing.home.mycompany.com
Node title: Development Node url: http://development.home.mycompany.com
Node title: Support Node url: http://support.home.mycompany.com
Node title: Services Node url: http://pso.home.mycompany.com



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on Global Navigation Or get search suggestion and latest updates.