Creating a site map can can take you some time and effort, depending on how fancy you need it. In Sharepoint you have the object PortalSiteMapDataSource that will feed the site structure, so all you nedd is something to consume it and render a visible presentation of the structure. This can be achieved in several ways. As an example I’m using a TreeView. Here is the code for a simple SiteMap.aspx page, using the minimal.master masterpage:
<%@ Page language="C#" MasterPageFile="_catalogs/masterpage/minimal.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server"> <PublishingNavigation:PortalSiteMapDataSource ID="SiteMapDS" Runat="server" SiteMapProvider="CurrentNavSiteMapProvider" EnableViewState="true" StartFromCurrentNode="true" StartingNodeOffset="1" ShowStartingNode="true" TrimNonCurrentTypes="Heading"/> <asp:TreeView runat="server" id="TreeView1" DataSourceiD="SiteMapDS" EnableTheming="true" ShowLines="true" ShowExpandCollapse="false"></asp:TreeView> </asp:Content>
This is a simple way of achieving a site map presentation.
Enjoy.
Are you sure this works with WSS?
Hi John,
this was actually built on Moss. I’ve checked the namespace of the SiteMApProvider and it is in Microsoft.SharePoint.Publishing.Navigation. Thus it should nor work in WSS as the Publishing infrastructure is not available there.
Regards,
Rui
Hi, I have used your code, it is working but the sitemap.aspx page is displayed as blank page, do u have any idea about that.
Thanks Deepak
Hi Deepak,
sorry for the delay on the reply.
have you looked up on the logs? Are you using MOSS or WSS?
About time! Someone with some data on this. You’d imagine judging how in need Comic Book Films are these days, some important information would in fact be fairly very easy to find. Surprisingly not. Anyway, thankyou for this! Very much appreciated!