Click here to Skip to main content
15,867,771 members
Articles / Productivity Apps and Services / Sharepoint / SharePoint 2010

Site Map Web Part (SharePoint Server 2010)

Rate me:
Please Sign up or sign in to vote.
4.57/5 (7 votes)
6 Jul 2014CPOL2 min read 104K   2.9K   12   19
Displays site structure in a hierarchical tree that is expandable and collapsible

 

Introduction

{A SharePoint 2013 version of the webpart is available here.]

Site Map Web Part displays structure of a Microsoft SharePoint Server 2010 site in a hierarchical tree that is expandable and collapsible. This web part is adapted from my SharePoint Server 2007 version.

Description

This Web Part uses a SiteMapProvider to render the site structure in a hierarchical tree that is expandable and collapsible. The SiteMapProvider is referenced from the site's web.config and is defaulted to be CurrentNavigation. In a publishing site, options to show subsites and/or pages are defined by each web's Navigation setting.

It has several public properties:

  • SiteMapProvider - (Site Map Provider) A site map provider that inherits from type SiteMapProvider defined in web.config. Default is CurrentNavigation.
  • StartNodeKey - (Starting Site URL) Server-relative URL for a starting sub-site.
    For example: /sub2/sub21. Default is /, the root site. If set to blank, starting sub-site will be the current site.
  • ExpandMap - (Expand Map?) Expand all nodes on page load. Default is true.
  • MaxLevels - (Maximum levels) Maximum number of node levels. Default is 0 for unlimited.
  • ListCssClass - CSS class name for the outermost <ul> tag. Default is smwp-list.
  • CurrentNodeCssClass - CSS class name for the current node. Default is smwp-current-node.

The Web Part uses a resource file to store all messages and property attribute UI strings. It demonstrates how to develop a custom class that inherits WebDescriptionAttribute, WebDisplayNameAttribute or CategoryAttribute and returns a localized string from your own Resource Manager.

The supplied Visual Studio 2013 solution includes all the support files you need to build and deploy this Web Part, minus the strong name key file. It makes full use of the built-in SharePoint integration. No more third party tools or custom pre and post build scripts are needed to build the SharePoint solution file.

Installation

If you are upgrading from a previous version, please refer to Version History for any special upgrade instructions.

Open SharePoint 2010 Management Shell, add solution file QuestechSystems.SharePoint.SiteMapWebPart.wsp using Add-SPSolution like

Add-SPSolution "C:\_deployment\QuestechSystems.SharePoint.SiteMapWebPart.wsp"

Go to SharePoint 2010 Central Administration/System Settings/Manage farm solutions. Deploy the installed solution to selected web applications. In the site collection where the solution is deployed, activate the Site Collection Feature Questech Systems Site Map Web Part. After that, the Site Map Web Part (listed under Questech Systems) should be available for you to add to pages.

History

  • V1.1 - 2014.07.06
    • Upgrade instructions from V1.0
      1. Delete all instances of old web parts.
      2. Retract old solution using PowerShell or via SharePoint 2010 Central Administration.
      3. Follow installation instructions as described in Installation section.
    • No longer set properties on global navigation provider. Thanks to Ryan McCarney for advising the implications.
    • Removed public properties IncludeSubSites, IncludePages, NodeCssClass and NoUrlNodeCssClass.
    • Included minimal styling.
  • V1.0 - 2010.05.19 - Initial version.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
A Microsoft Certified Professional Developer and Technology Specialist.

Experience and expertise in SharePoint 2016 / 2013 / 2010 / 2007.

Role ranges from a developer in a multi-person team to a solution consultant with expert-level skills, leading a project to completion status.

Proven experience working effectively in a team environment and a self-managed environment.

Comments and Discussions

 
QuestionInvalid SiteMapProvider: CurrentNavigation Pin
Member 1419891427-Mar-19 15:09
Member 1419891427-Mar-19 15:09 
QuestionSP 2013 Question - Does not display Managed Metadata Navigation Pin
Madd_Matt4-Dec-14 9:19
Madd_Matt4-Dec-14 9:19 
AnswerRe: SP 2013 Question - Does not display Managed Metadata Navigation Pin
Madd_Matt4-Dec-14 11:34
Madd_Matt4-Dec-14 11:34 
GeneralRe: SP 2013 Question - Does not display Managed Metadata Navigation Pin
Stephen Huen4-Dec-14 20:14
Stephen Huen4-Dec-14 20:14 
QuestionHow To Created Site Map For My HTML Web Site? Pin
Tahir Malek1-Dec-14 0:26
Tahir Malek1-Dec-14 0:26 
QuestionProblem with webpart Pin
fajry15-Jul-12 21:49
fajry15-Jul-12 21:49 
QuestionDoesn't show our whole site. Pin
Bob Eadie16-Jun-12 6:08
Bob Eadie16-Jun-12 6:08 
QuestionError when deployig as a sandboxed solution Pin
Tariq Afzal14-May-12 0:45
Tariq Afzal14-May-12 0:45 
QuestionRe: Error when deployig as a sandboxed solution Pin
Juan Sebastian Vanegas6-Jun-12 6:04
Juan Sebastian Vanegas6-Jun-12 6:04 
QuestionSite Map not populating Pin
LouisePe23-Aug-11 4:21
LouisePe23-Aug-11 4:21 
AnswerRe: Site Map not populating Pin
lzandman22-Dec-11 0:09
lzandman22-Dec-11 0:09 
GeneralRe: Site Map not populating Pin
lzandman22-Dec-11 0:56
lzandman22-Dec-11 0:56 
GeneralRe: Site Map not populating Pin
art261916-Jan-12 3:45
art261916-Jan-12 3:45 
QuestionHow do you display only sub sites of the selected site? [modified] Pin
Member 332363025-Jul-11 6:12
Member 332363025-Jul-11 6:12 
GeneralMy vote of 4 Pin
mohammed sadeq16-Jul-11 13:48
mohammed sadeq16-Jul-11 13:48 
Questioncss class for site map web part Pin
Thalavady12-May-11 0:38
Thalavady12-May-11 0:38 
Generalleft side menu error Pin
p yadav1-May-11 18:06
p yadav1-May-11 18:06 
GeneralPortalSiteMapProvider Encoding HTML Twice Pin
Thiago Silva2-Mar-11 9:52
Thiago Silva2-Mar-11 9:52 
Before installing this web part on my site collection, my left nav menu items where the Title contained the "&" character were already being encoded by the provider.

After installing the web part, it seems like the PortalSiteMapProvider.EncodeOutput property has been reset and now my menu items with "&" are being double encoded, so that they render the following: &amp;amp; (where the first part - &amp; - is the newly encoded "&" from the original &amp; in the Title).


What's the best way to fix this?
Regards,
Thiago Silva

GeneralRe: PortalSiteMapProvider Encoding HTML Twice Pin
Thiago Silva2-Mar-11 13:19
Thiago Silva2-Mar-11 13:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.