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=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. 

About these ads

Actions

Information

5 responses

17 12 2008
John

Are you sure this works with WSS?

16 02 2009
ruimelo

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

30 01 2009
Deepak

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
ruimelo

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:

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




Follow

Get every new post delivered to your Inbox.

Join 429 other followers

%d bloggers like this: