Creating a site map for WSS/MOSS

4 03 2008

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=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server"> 
        ID="SiteMapDS" Runat="server" 
        <asp:TreeView runat="server" 
         ShowExpandCollapse="false"></asp:TreeView> </asp:Content>

This is a simple way of achieving a site map presentation.




5 responses

17 12 2008

Are you sure this works with WSS?

16 02 2009

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.


30 01 2009

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

16 02 2009

Hi Deepak,

sorry for the delay on the reply.
have you looked up on the logs? Are you using MOSS or WSS?

13 12 2010
Darrick Raviele

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!

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: