Custom Quick Launch Menu Provider for MOSS

I have been trying from few hours now to get the custom data source for Quick Launch menu for my MOSS site to work by following the documentation on MSDN for custom navigation data source

Everything seems fine but my page is just not picking up data from my custom source 😦 after digging a bit in 12 hive it turns out that Sequence number used in the MSDN sample above is 50

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="QuickLaunchDataSource" Sequence="50" ....

and Sequence number in out-of-box MySiteQuickLaunchFeatureElements.xml located under \12\TEMPLATE\FEATURES\MySiteQuickLaunch is 25! bummer

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control Id="QuickLaunchDataSource" Sequence="25"

all I had to do for my custom Datasource is to use a lower number than 25 in the the <Control… element

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control Id="QuickLaunchDataSource" Sequence="10"
    ControlClass="System.Web.UI.WebControls.SiteMapDataSource"
    ControlAssembly="System.Web, version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <Property Name="SiteMapProvider">CustomQuickLaunchProvider</Property>
    <Property Name="EnableViewState">true</Property>
    <Property Name="ShowStartingNode">false</Property>
    <Property Name="ID">QuickLaunchSiteMap</Property>
  </Control>

</Elements>

In the above XML SiteMapProvider property (CustomQuickLaunchProvider) points to MapProvider configured in the web.config

<add name="CustomQuickLaunchProvider" description="Provider for navigation in Portal Usage pages" type="Navigation.CustomQuickLaunchProvider, Navigation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be375f840b34f8de" />

Following code in the feature receiver changes the web.config to add the CustomQuickLaunchProvider

private void ChangeWebConfig(SPWebApplication webApp)
{
            string assembly = typeof(CustomQuickLaunchProvider).AssemblyQualifiedName;

            SPWebConfigModification configModification = new SPWebConfigModification("add[@name='CustomQuickLaunchProvider']", "configuration/system.web/siteMap/providers");
            configModification.Sequence = 0;
            configModification.Owner = "CustomQuickLaunchProvider";
            configModification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
            configModification.Value = string.Format("<add name=\"CustomQuickLaunchProvider\" description=\"Provider for navigation in Portal Usage pages\" type=\"{0}\" />", assembly);

            webApp.WebConfigModifications.Add(configModification);
            webApp.WebService.ApplyWebConfigModifications();

}

UPDATE:
Link to Sample Code: Quick Launch Provider

Advertisements

7 thoughts on “Custom Quick Launch Menu Provider for MOSS

  1. I’m also very interested in de sample code and the actual contents of the alternative Quicklaunchmenu. Thanks in advance

  2. I would like to see your source code, but the page is not accessible now. : (

    I appreciate it if you can post it again.

  3. Can you provide the sample code again the link is broken, I am interested in building a custom navigational component

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s