Introduction
For use in Microsoft Office SharePoint Server (MOSS) 2007, this Web Part displays the site structure in a hierarchical tree that is expandable and collapsible. It is based on my Site Map custom control written for Content Management Server 2002.
Description
The Web Part uses a PortalSiteMapProvider to render the site structure in a hierarchical tree that is expandable and collapsible. The PortalSiteMapProvider is referenced from the site's web.config and is defaulted to be CurrentNavSiteMapProvider, as used in the out-of-the-box "Current Navigation".
It has several public properties:
SiteMapProvider - (Site Map Provider) A site map provider of type PortalSiteMapProvider. Default is CurrentNavSiteMapProvider
StartNodeKey - (Starting Site URL) Server-relative URL for a starting sub-site.
For example: /PressReleases/2006. Default is the root site.
ExpandMap - (Expand Map?) Expand all nodes on page load. Default is true
IncludeSubSites - (Include sub-sites?) Show sub-sites in node. Valid values are Always, Never and PerWeb. Default is PerWeb, i.e. a per sub-site setting configurable in the Modify Navigation Site Actions menu
IncludePages - (Include Pages?) Show pages in nodes. Valid values are Always, Never and PerWeb. Default is PerWeb, i.e. a per sub-site setting configurable in the Modify Navigation Site Actions menu
MaxLevels - (Maximum levels) Maximum number of node levels
ListCssClass - CSS class name for the outermost <ul> tag
NodeCssClass - CSS class name for regular hyperlinked nodes
CurrentNodeCssClass - CSS class name for a selected node
NoUrlNodeCssClass - CSS class name for nodes with no URL, like headings
The Web Part uses two methods to include resources. Images are treated as Class Resources and JavaScript files are treated as Embedded Resources. To package images as Class Resources in a Solution, include them in Manifest.xml, like:
="1.0" ="utf-8"
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="SolutionGuid" ResetWebServer="TRUE">
<Assemblies>
<Assembly Location="QuestechSystems.SharePoint.Publishing.SiteMap.dll"
DeploymentTarget="GlobalAssemblyCache">
<ClassResources>
<ClassResource Location="images\node-closed.gif" />
<ClassResource Location="images\node-open.gif" />
<ClassResource Location="images\node.gif" />
</ClassResources>
<SafeControls>
<SafeControl Assembly="QuestechSystems.SharePoint.Publishing.SiteMap,
Version=1.0.0.0,
Culture=neutral, PublicKeyToken=AssemblyToken"
Namespace=
"QuestechSystems.SharePoint.Publishing.WebControls"
TypeName="*" Safe="True" />
</SafeControls>
</Assembly>
</Assemblies>
<FeatureManifests>
<FeatureManifest Location="QuestechSiteMapWebPart\Feature.xml" />
</FeatureManifests>
</Solution>
In Solution deployment, resource files are deployed based on the assembly destination. For assemblies deployed to the bin directory, resource files are copied to an assembly subdirectory under the wpresources directory of the destination IIS Web application. For assemblies deployed to GAC, resource files are copied to an assembly subdirectory under virtual directory _wpresources. In the code, a path to resource files is obtained from SPWebPartManager.GetClassResourcePath.
For the JavaScript file SiteMap.js, set its build action to "Embedded Resource" in Visual Studio 2008. In code, reference the file using Page.ClientScript.GetWebResourceUrl. You will need to pass in the file in the form of [Assembly of project].[Folder containing resource].[Filename of resource]. In AssemblyInfo.cs, include SiteMap.js in the same format like:
[assembly: System.Web.UI.WebResource
("QuestechSystems.SharePoint.Publishing.ClientScripts.
SiteMap.js", "text/javascript")]
The Web Part also 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 sample Visual Studio 2008 solution includes all the support files you need to build and deploy this Web Part, minus strong name key files (*.snk). It contains three projects: Deployment, Features and SharePoint.Publishing. The SharePoint.Publishing project contains source codes for the Web Part. The Features project contains all the features to support the SharePoint.Publishing project. The Deployment project contains a pre-build script to aggregate all the files needed for deployment. It contains a Solution directory where a WSP file is generated and deployed by a post-build script.
This structure of Visual Studio solution and projects is scalable to full blown MOSS/WSS development and deployment. You could add additional projects like SharePoint for WSS or MOSS non-publishing development or SharePoint.ApplicationPages for customization of administrative layout pages. Within your projects, you could have other custom components like user and Web controls, custom fields, feature receivers, etc.
Installation
Using stsadm, install solution file QuestechSiteMap.wsp in \Deployments\Solution\:
stsadm -o addsolution -filename QuestechSiteMap.wsp
Go to SharePoint Central Administration/Operations/Global Configuration-Solution Management. Deploy the installed solution to selected Web applications. In the site collection where the solution is deployed, activate Feature Questech Systems Site Map Web Part. After that, the Site Map Web Part should be available for you to add to pages.
References
- CodeGuru: Write Custom WebParts for SharePoint 2007
- Eric Stallworth: How To Build a Solution Pack (WSP)
- Stephen Huen: Microsoft Content Management Server Site Map control (C#)
History
- V1.5 - 2009.05.22
- Converted Visual Studio solution projects to version 2008
- New SharePoint Solution QuestechSiteMap.wsp and assembly QuestechSystems.SharePoint.Publishing.SiteMap.dll. This allows my other sample solutions in CodeProject to co-exist with this Web Part.
- Renamed feature from QuestechPublishingWebParts to QuestechSiteMapWebPart
- V1.4 - 2008.04.12
- Included sample Visual Studio 2005 solution for compiling and deploying the Web part
- Updated installation instructions
- V1.31 - 2007.10.02
- Removed InstallPackage.bat as it confuses people that a compilation is not needed
- V1.3 - 2007.09.18
Namespace and class name changed
- Added properties
SiteMapProvider and IncludeSubSites
- Added resource file for property attribute UI
strings and error messages
- Removed sitemap.wsp from sample files
- V1.21 - 2007.04.25
- Removed limit of 50 nodes/sites at each level
- V1.2 - 2007.04.20
- Removed restriction on "Publishing" site types only
- V1.12 - 2007.04.11
- Fixed sitemap.wsp solution install error
- V1.11 - 2007.03.20
- Fixed missing icon images
- Better error handling
- V1.1 - 2007.03.06
- Extracted JavaScript codes to external *.js file as embedded resource
- Relocated icon images to be used as class resource
- V1.0 - 2006.12.07 - Base
| You must Sign In to use this message board. |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
I found that all gifs (node*.gif) are unable to show.
I checked that these file physically stored at
C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\QuestechSystems.SharePoint.Publishing.SiteMap\1.0.0.0__452af7a31a63d586\Images
and the URL of image is
http://machine_name/SiteDirectory/_wpresources/QuestechSystems.SharePoint.Publishing.SiteMap/1.0.0.0__452af7a31a63d586/images/node.gif
What is the problem?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I was not able to reproduce the problem. If you hit http://machine_name/SiteDirectory/_wpresources/QuestechSystems.SharePoint.Publishing.SiteMap/1.0.0.0__452af7a31a63d586/images/node.gif in the browser, do you get a 404?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Not 404 error.
Server Error in '/' Application. --------------------------------------------------------------------------------
This type of page is not served. Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.gif' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /_wpresources/QuestechSystems.SharePoint.Publishing.SiteMap/1.0.0.0__452af7a31a63d586/images/node.gif
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Looks like something to do with your IIS/ASP.Net configuration. May be article http://support.microsoft.com/kb/815152 will help.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
I have also got the same problem. I have used Team site templates to create my sites. It does show the image, the source of the image is like "http :// SITE /_wpresources/QuestechSystems.SharePoint.Publishing.SiteMap/1.0.0.0__452af7a31a63d586/images/node-open.gif"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
This is a great webpart but it displays only the publishing sites. It does not display the team sites along with the publishing sites. Is there any way or any code change so that this webpart displays both publishing as well as non publishing website in the site map. Any idea would be highly appreciated.
Thanks, AR
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thanks for the wonderful solution. I was just curious if we can go mor deep down . If I have Folder on the shared document , showing the folder and sub folder as well like in tree view if Sharepoint
Thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Does anyone know on how to solve the problem when trying to add this webpart into the webpart zone and it gives the error saying that "Cannot import this webpart". I really need to use this webpart. Thank you in advance. :(
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
|
 |
|
 |
Hi
I am having MOSS 2007 and Visual studio 2005 installed. I also got the visual studio extensions for wss3.0, but still when I am trying to open the solution file then I am getting the message that the "project type is not supported by the installation". Can you please tell me what is the requirement to open this solution file?
Thanks in advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi
I have installed web application project support and vs2005 sp1 from following links.
http://www.microsoft.com/downloads/details.aspx?familyid=8B05EE00-9554-4733-8725-3CA89DD9BFCA&displaylang=en
http://www.microsoft.com/downloads/details.aspx?familyid=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&displaylang=en
Still the problem is same.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
I am having Visual studio 2005 team edition for software developers version 8.0.50727.42. Please give me any link to download sp1 if you have.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I am not sure why. The SP1 link, http://www.microsoft.com/downloads/details.aspx?familyid=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&displaylang=en, seems right but it indicates version 50727.762 while you have 50727.42. My suggestion is for you to reinstall it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
What are the license terms for this web part? I wasn't able to find anything inside the package nor on this page.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Hi, eventually I almost got it working. I tried to connect my new control to the existing sitemap data source, but I get the following error:
Invalid SiteMapProvider: SiteMapDataSource1
Does anyone know what I am doing wrong here? (btw, SharePoint Designer does not recognize my <DW: tag.. is that normal?)
My markup looks like this:
<%@ Register TagPrefix="DW" Namespace="QuestechSystems.SharePoint.Publishing.WebControls" Assembly="VerticalNavigation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d6a60c3d38efc327" %> . . . <DW:VerticalNavigation runat="server" IncludePages="true" IncludeSubSites="true" SiteMapProvider="SiteMapDataSource1"></DW:VerticalNavigation> <PublishingNavigation:PortalSiteMapDataSource ID="siteMapDataSource1" Runat="server" SiteMapProvider="CombinedNavSiteMapProvider" EnableViewState="true" StartFromCurrentNode="true" StartingNodeOffset="0" ShowStartingNode="false" TreatStartingNodeAsCurrent="true" TrimNonCurrentTypes="Heading"/>
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
 | How to  carlosfocker | 9:27 23 Jan '08 |
|
 |
I'm not sure where to start with this. You say I need to compile the code first before I use it in a solution. What type of VS.NET project do I use to compile it? Where is the QuestechSystems.SharePoint.Publishing.dll that is referenced in the manifest.xml and the ddf file? Do I put the images in the solution package? A step by step would greatly improve this page.
|
| Sign In·View Thread·PermaLink | 2.80/5 |
|
|
|
 |
|
 |
When I build the project I get the error:
Error 1 'Resources': member names cannot be the same as their enclosing type C:\Dev\SiteMapWebPart\SiteMapWebPart\Properties\Resources.Designer.cs 82 32 SiteMapWebPart
What am I missing?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|