- Create a Microsoft Visual C# class library project with following code, add the required references, and then build the project.
using System;using System.Collections.Generic;using System.Text;using Microsoft.SharePoint.Publishing;using Microsoft.SharePoint.Publishing.Navigation;using System.Web;using System.Web.UI.WebControls;using System.Configuration;
namespace MyCustomNav
{
public class Navigation: PortalSiteMapProvider
{
public override SiteMapNodeCollection
GetChildNodes(System.Web.SiteMapNode node)
{PortalSiteMapNode pNode = node as PortalSiteMapNode;
if (pNode != null)
{if (pNode.Type == NodeTypes.Area)
{SiteMapNodeCollection nodeColl = base.GetChildNodes(pNode);
SiteMapNode childNode = new
SiteMapNode(this, “”,
“”, “Microsoft”);
SiteMapNode childNode1 = new
SiteMapNode(this, “”,
“”,
“Support”);nodeColl.Add(childNode);
SiteMapNodeCollection test = new
SiteMapNodeCollection();test.Add(childNode1);
childNode.ChildNodes = test;return nodeColl;
}elsereturn base.GetChildNodes(pNode);
}elsereturn new SiteMapNodeCollection();
}}}
- Copy the .dll file you created in step 1, and then paste it into the Office SharePoint Server 2007 virtual directory’s bin folder.
- Create the following entry in the web.config file for the Web application, and then set the trust level to Full.
<add name=”MyCustomNavigationProvider” type=”MyCustomNav.Navigation, MyCustomNav”
NavigationType=”Current”/>
- Create a custom master page and add the following code under the top navigation’s ContentPlaceHolder element.
<sharepoint:aspmenuid=”topnavigationmenu” runat=”server” datasourceid=”topSiteMap1″ enableviewstate=”false” accesskey=””>” Orientation=”Horizontal” StaticDisplayLevels=”1″ MaximumDynamicDisplayLevels=”3″ DynamicHorizontalOffset=”0″ StaticPopoutImageUrl=”/_layouts/images/menudark.gif” StaticPopoutImageTextFormatString=”” DynamicHoverStyle-BackColor=”#CBE3F0″ SkipLinkText=”” StaticSubMenuIndent=”0″ CssClass=”ms-topNavContainer”>
<staticmenustyle/><staticmenuitemstyle cssclass=”ms-topnav” itemspacing=”0px”/><staticselectedstyle cssclass=”ms-topnavselected”/><statichoverstyle cssclass=”ms-topNavHover”/><dynamicmenustyle backcolor=”#F2F3F4″ bordercolor=”#A7B4CE” borderwidth=”1px”/><dynamicmenuitemstyle cssclass=”ms-topNavFlyOuts”>/><dynamicselectedstyle cssclass=”ms-topNavFlyOutsSelected”/></SharePoint:AspMenu>
<asp:sitemapdatasource showstartingnode=”False” sitemapprovider=”MyCustomNavigationProvider” id=”topSiteMap1″ runat=”server” startfromcurrentnode=”true”>
- Reset Microsoft Internet Information Server (IIS). Your SharePoint site should now show the updated navigation from the extended navigation provider.
Still more to come…
Cheers…
Often I wouldn’t find out content upon websites, having said that i would like to say that this kind of write-up extremely pushed me personally to have a look during along with get it done! Your current crafting tastes continues to be surprised us. Thanks, quite fantastic post.
Excellent blog! Do you have any tips and hints for aspiring writers?
I’m planning to start my own blog soon but I’m a little lost
on everything. Would you recommend starting with a free platform
like WordPress or go for a paid option? There are
so many choices out there that I’m totally confused .. Any suggestions? Thanks a lot!