Partilhar via


SharePoint 2007/MOSS Central Administration Site – Quick Launch Bar Customization…

 

The issue that I want to talk about here may not have a direct solution to it, but definitely have some satisfying explanations.
Recently I wanted to add some custom pages in SharePoint central admin site which allows me to configure some custom farm level functions. So I started with adding new links into the Quick Launch Bar (aka. Left Navigation Bar) but no matter what I did, the newly created links just don’t show themselves in the Quick Launch Bar…

Perhaps a few more screenshots would explain the problem better:

Problem Description
================

In SharePoint Central Administration site, I tried to add a new link to Quick Launch Bar (Left Navigation Bar) by going to Site Actions –> Site Settings –> [Look and Feel] –> Quick Launch –> New Link

image

image

 

As you can see that the new link "test” has been added and visible in /_layouts/quiklnch.aspx page, but when I browse back to central admin site home page, the Quick Launch bar stayed the same.

Analysis
================

1. The “test” link is stored in central admin site’s content database’s NavNodes table.

2. Adding new links to Top Navigation Bar in central admin site has no such problem.

3. The default.master shows the following markup for Quick Launch Bar (I removed the <asp:MenuItemStyles> tags).

 <Sharepoint:SPNavigationManager
        id="QuickLaunchNavigationManager"
        runat="server"
        QuickLaunchControlId="QuickLaunchMenu"
        ContainedControl="QuickLaunch"
        EnableViewState="false">
    <div>
        <SharePoint:DelegateControl runat="server" ControlId="QuickLaunchDataSource">
            <Template_Controls>
                <asp:SiteMapDataSource
                        SiteMapProvider="SPNavigationProvider"
                        ShowStartingNode="False"
                        id="QuickLaunchSiteMap"
                        StartingNodeUrl="sid:1025"
                        runat="server"
                        />
            </Template_Controls>
        </SharePoint:DelegateControl>
            <SharePoint:AspMenu
                    id="QuickLaunchMenu"
                    DataSourceId="QuickLaunchSiteMap"
                    runat="server"
                    Orientation="Vertical"
                    StaticDisplayLevels="2"
                    ItemWrap="true"
                    MaximumDynamicDisplayLevels="0"
                    StaticSubMenuIndent="0"
                    SkipLinkText=""
                    >
        </SharePoint:AspMenu>
    </div>
</Sharepoint:SPNavigationManager>

The Sharepoint:AspMenu points its data source to the asp:SiteMapDataSource control which was then enclosed and provided by SharePoint:DelegateControl. This means that the asp:SiteMapDataSource control that will be used in this instance was actually decided by the SharePoint Features enabled on this site. There may be multiple features enabled on a site with the same control ID=”QuickLaunchDataSoure”, but the one with the lowest Sequence number will be the winner and used by SharePoint:DelegateControl.

For more info about SharePoint Delegate Control, refer to CHRIS O'BRIEN - Using the Delegate Control

4. The web.config file for SharePoint central administration site shows the following  <siteMap> section.

 <siteMap defaultProvider="CurrentNavSiteMapProvider" enabled="true">
      <providers>
        <add name="SPNavigationProvider" type="Microsoft.SharePoint.Navigation.SPNavigationProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="SPSiteMapProvider" type="Microsoft.SharePoint.Navigation.SPSiteMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="SPContentMapProvider" type="Microsoft.SharePoint.Navigation.SPContentMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="SPXmlContentMapProvider" siteMapFile="_app_bin/layouts.sitemap" type="Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="AdministrationQuickLaunchProvider" description="QuickLaunch navigation provider for the central administration site" type="Microsoft.Office.Server.Web.AdministrationQuickLaunchProvider, Microsoft.Office.Server.UI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="SharedServicesQuickLaunchProvider" description="QuickLaunch navigation provider for shared services administration sites" type="Microsoft.Office.Server.Web.SharedServicesQuickLaunchProvider, Microsoft.Office.Server.UI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="GlobalNavSiteMapProvider" description="CMS provider for Global navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Global" EncodeOutput="true" />
        <add name="CombinedNavSiteMapProvider" description="CMS provider for Combined navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Combined" EncodeOutput="true" />
        <add name="CurrentNavSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" />
        <add name="CurrentNavSiteMapProviderNoEncode" description="CMS provider for Current navigation, no encoding of output" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="false" />
        <add name="SiteDirectoryCategoryProvider" description="Site Directory category provider" type="Microsoft.SharePoint.Portal.WebControls.SiteDirectoryCategoryProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="MySiteMapProvider" description="MySite provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteMapProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="MySiteLeftNavProvider" description="MySite Left Nav provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteLeftNavProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="UsagePagesSiteMapProvider" description="Provider for navigation in Portal Usage pages" type="Microsoft.SharePoint.Portal.Analytics.UsagePagesSiteMapProvider, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <add name="SPXmlAdminContentMapProvider" siteMapFile="_app_bin/admin.sitemap" type="Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      </providers>
</siteMap>

What caught my eyes was “AdministrationQuickLaunchProvider”. The description for that tag clearly states “QuickLaunch navigation provider for the central administration site”, so there must be a feature that’s using this site map provider in the SharePoint Delegate Control. A quick search in the Features folder under the 12 hive shows “OsrvLinks” (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\OsrvLinks) is the feature that I was after.

Below shows the content of OsrvLinks\serverroleselector.xml and we can see that it uses “AdministrationQuickLaunchProvider” as the site map provider for the QuickLaunchDataSource control. It has a Sequence number of 25 which must be the lowest in this case. The default value for Sequence number is 100.

 <Elements xmlns="https://schemas.microsoft.com/sharepoint/">
    <Control Id="ServicesOnServerRoleControl" Sequence="100" ControlSrc="~/_admin/serverroleselector.ascx" />
    <Control Id="CentralAdminLeftNavBarTop" Sequence="100" ControlSrc="~/_admin/configurationmonitor.ascx" />
    <Control Id="QuickLaunchDataSource" Sequence="25"
        ControlClass="Microsoft.Office.Server.WebControls.SiteMapDataSource" 
        ControlAssembly="Microsoft.Office.Server.UI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
        <Property Name="SiteMapProvider">AdministrationQuickLaunchProvider</Property>
        <Property Name="ShowStartingNode">false</Property>
        <Property Name="ID">QuickLaunchSiteMap</Property>
    </Control>
</Elements>

To verify this, I run the following STSADM command to check whether this feature is already activated on central admin site and YES, it’s activated already.

image

Now I run the STSADM command again to deactivate it then see if I can get my “test” link to show up on the Quick Launch Bar, since some other site map provider will be used instead of AdministrationQuickLaunchProvider.

image

 

VOILA! Here is my “test” link showing up in the Quick Launch Bar. (with the side effect of miss SSP links….. , which is not the issue that I want to talk about here… :p)

image 

5. To find out more about how AdministrationQuickLaunchProvider handles and finds navigation nodes, I loaded up Microsoft.Office.Server.UI.DLL in the Reflector from GAC (“C:\windows\assembly\gac_msil\Microsoft.Office.Server.UI\version_PublicKeyToken\” folder). You can find  AdministrationQuickLaunchProvider under Microsoft.Office.Server.Web namespace. The class only has one single method, and within that method, GetChildNodes(SiteMapNode), I can see clearly the navigation nodes were hardcoded and added within the method. This pretty much explains why no matter how I try to edit the site template, site definitions or the quick launch bar, the links never change.

Conclusion
================

The Quick Launch Bar in SharePoint central administration site is controlled by “OsrvLinks” feature. This feature uses AdministrationQuickLaunchProvider as the site map provider, but AdministrationQuickLaunchProvider class hardcoded the links (Operations and ApplicationManagement) in its GetChildNodes method. Therefore there is no way to add/remove any link from the Quick Launch Bar as long AdministrationQuickLaunchProvider is used.