"To be positive: To be mistaken at the top of one's voice." - Ambrose Bierce
Scott Valentine
Los Alamos, NM
USA
Michael A. Vickers
Portland, CT
USA
Friday, June 15, 2007
Not-So-Global Navigation In SharePoint
This is another fabulous adventure in nerdville. I'm posting this mostly for my own edification, so the three people who read this blog and are not finding themselves here via the General Lee, feel free to move along.

I am still getting my head wrapped around the paradigm that is SharePoint. From one perspective, it's a great platform to starts or build your intranet on if you have a lot of money (I call it "intranet-in-a-box") and not a tremendous amount of know-how. You can start creating portals and sites in no time at all, create rudimentary data models to hold information, set permissions on everything, and then start pumping information into it.

From the other perspective (that would be mine, or if I may be so presumptuous to call my perspective "the developer at large") it can be a complete PITA. I'm finding that even the slightest modification to the system which can not be handled via the web-based tools or even the new SharePoint Designer software requires time, patience, and a deep swear jar.

The latest incident involves trying to use the same global navigation bar in the "MySite" portal as the parent portal. I would think this would be a fairly trivial task, but not really. Actually, it kind of is after googling the entire Internet and finally finding a solution (it's located in the comments).

Of course, the solution didn't quite work as-is, so I'll regurgitate.

In the masterpage of the offending MySite portal there is a "SharePoint:AspMenu" tag, which is where all the action is at. There are at least a couple, so find the one specifically with the "TopNavigationMenu" ID. Mine looks something like this:
<SharePoint:AspMenu
ID="TopNavigationMenu"
Runat="server"
DataSourceID="topSiteMap"
EnableViewState="false"
blah blah blah />
Note the DataSourceID. This tells the control where to get the info it needs (namely the titles on the menu and the links they go to).

This object containing the DataSourceID is located a little further down the page:
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>
OK, now we're getting somewhere. According to the aforementioned post and comment, this little bit of code provides a contextual data source for the menu at run-time. The way to force it to use a data source of my choosing (there are a handful of them defined in the web.config for the application) is to wipe that piece of code out altogether and replace it with something resembling the following:

<PublishingNavigation:PortalSiteMapDataSource
ID="topSiteMap"
Runat="server"
SiteMapProvider="CombinedNavSiteMapProvider"
StartFromCurrentNode="true"
ShowStartingNode="false"
TreatStartingNodeAsCurrent="true"
TrimNonCurrentTypes="Heading"
/>
And for this tag to be recognized on the page there must be an accompanying registration for it at the top:
<%@ Register Tagprefix="PublishingNavigation"
Namespace="Microsoft.SharePoint.Publishing.Navigation"
Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=94de0004b6e3fcc5" %>
So far, so good, except after doing this I received the following error message on the page:
Could not load file or assembly 'Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=94de0004b6e3fcc5' or one of its dependencies. The system cannot find the file specified
Huh?

Turns out the problem here is simple -- the "PublicKeyToken" didn't seem to match correctly for me as quoted in the post. Along side that registration I put in were other registrations which had matching PublicKeyToken values. I simply copied that value over and voila, it worked.

So far the only menu I can get it to display is the custom one you create through the process of customizing the site navigation for the specific MySite portal. I can't figure out how to set the site navigation to the same one as the parent portal, but as long as I have some control over it for the time being I'm fine with having to set the navigation in two different areas.

Labels: ,


0 shot(s) from the peanut gallery.
Post a Comment






People We Know


People We Keep Up With


Categories of Interest


Ye Olde Archives

December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007

Useful Stuff


www.flickr.com
This is a Flickr badge showing public photos from Michael A. Vickers.


Subscribe to Idiotsyncrasies RSS Feed