Sharepoint 2010 Subsites webpart

Print Friendly, PDF & Email

 

UPDATE: There is a new version of the subsites webpart available for download. the new webpart adds sorting of the subsites list. the new version can be downloaded here.

This is a simple webpart to show a list (with links) of subsites immediately below the current site.

Subsites webpart

This webpart will work on both Sharepoint 2010 and Sharepoint Foundation. On Sharepoint 2010 you could have used the built in “Table of Contents” webpart to do similar things but this one can also display the list as a dropdown list to save space on the webpage and it can open links in a new window.

subsites webpart dropdown list subsites webpart dropdown list

All the settings can by edited in the webpart configuration panel.

subsites webpart configuration

The settings are:

  • Show bullet in list – this will display the small square gif in front of the site name
  • Open link in new window – this will open the subsite in a new window
  • Show Site Description – this will show the description you entered when you created the subsite
  • Show icon – Shows a icon for the type of subsite, see picture.
  • Show as dropdown list – Will display the subsites in a dropdown box to save space.
UPDATE: There is a new version of the subsites webpart available for download. the new webpart adds sorting of the subsites list. the new version can be downloaded here.

The webpart can be downloaded here and is free of charge, use for whatever you need.

(If you need the subsites webpart for MOSS 2007 or Windows Sharepoint Services 3.0 (WSS) you can download that from here Subsites Webpart for Moss 2007.)

Unzip the downloaded file and install the  Subwebs.wsp file on your Sharepoint server. Instructions on how to install a wsp file can be found here.

Update: You can now download the source code for this webpart here http://sharepoint247.com/wss3/subsites-webpart-source-code/

35 thoughts on “Sharepoint 2010 Subsites webpart

  1. Hi,

    Should the Subsites webpart automatically update to include newly added sites?

    Thanks,

    Ken

    1. Yes the webpart should automatically update to include new subsites.
      The webpart should show every subsite that the user have permissions to access.

  2. Hi Arild,

    Thanks for creating this webpart, it works fine.
    However, the images will not show (bullet and team site icon etc.)
    The HTML in the page source for these images also seems to be wrong/empty:

    Any idea how I can fix this?

    Many thanks,
    Waldemar

    1. Hi, the webpart should use the built-in Sharepoint images for this. It’s supposed to show the images from /_layouts/images/docicon.gif and the bullet would be /_layouts/images/square.gif
      So you should verify that those files exists in http://<your site URL/_layouts/images folder

      Arild

  3. Hi

    For expediency I simply tried install via the solution gallery

    This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution ‘5758fde1-f281-4a43-9682-ac1203f38632’ failed validation, file manifest.xml, line 10, character 4: The element ‘Solution’ in namespace ‘http://schemas.microsoft.com/sharepoint/’ has invalid child element ‘TemplateFiles’ in namespace ‘http://schemas.microsoft.com/sharepoint/’. List of possible elements expected: ‘FeatureManifests, ActivationDependencies’ in namespace ‘http://schemas.microsoft.com/sharepoint/’.

    I guess I need to follow the install instructions via powershell and stsadm

  4. Awesome thanks, have it working like a charm in my master page (needed separate sub site nav to the quicklaunch)

    Just got to work out how to style it now!

    Thanks again
    K

  5. New to Sharepoint. I would really like to use this. I downloaded and did everything in the instructions. It appeared, from ps that it was deployed. Couldn’t find the part anywhere in the system to add it to a page. At a complete loss at what else to try so I completely removed it from the system.

    1. The webpart is installed as a feature. Check Site Collection Features under Site Settings and make sure the feature is activated.

  6. Would love to get an uploadable .DWP or .WEBPART. Leveraging Microsoft’s 365 doesn’t give me access to install webparts at the site collection level.

    I can however upload a .DWP or .WEBPART file.

    Any chance you can make one available for download on your site?

    Thanks in advance.

    1. The original webpart would not run on Office 365 because of some code used that is not allowed in a sandboxed solution.
      I have compiled a new version that will run on Office 365. It’s basically the same project but I changed a few code lines and compiled it as a sandboxed solution.
      I just testet it on Office 365 and it seems to be functioning fine. I only tested for a few minutes though so please let me know if there’s any problems.
      You can download from the following link Subsites Webpart for Office 365
      This is a ZIP file containing the WSP file that can be installed on Office 365. Go to Site Settings and Solutions on your Office 365 site to install. Remember to Activate the Solution before trying to add the webpart.
      I will post an article later that explains in more detail the steps necessary to install the sandboxed solution on Office 365.

      1. Awesome. Thanks so much! I have it up and running on a sample site. I appreciate all of your efforts!

  7. Anyway to get this file in .DWP or .WebPart format? I want to leverage MS’s 365 SharePoint 2010 solution, but I don’t have access to STADMIN and the likes to install this for the entire “Site”. Rather I do have access to upload the .DWP or .WEBPART file. Any chance you can post that for download?

    Thank you kindly in advance.

  8. Installing the web part using the CAB file worked fine. Seems to be functioning as expected. Thanks for your help and for creating this WP.

  9. Downloaded the cab file and installed fine. Seems to be be working as expected. Thanks for all of your help and effort on creating this WP.

  10. In the above dialogue, everyone is referring to the ZIP file containing the WSP file. When I download and unzip I get an MSI ont a WSP. I ran the installed and it indicates it is installed but what is the installer actually doing?

    Thanks

    1. Hi,

      You probably downloaded the webpart for MOSS 2007, that does contain a MSI file.
      The one for Sharepoint 2010 contains an WSP file and you can download that here

      1. Thanks fot the quick reply.

        I need the Moss 2007 version that is why I downloaded it. Can you clarify the procedure for the MSI? I know what to do with a WSP but not sure what the MSI is actually doing in the background.

        Thanks again.

        1. The MSI file for MOSS 2007 is created by using the WPPackager tool from microsoft. This tool is used for creating easy installation of webparts for the older Sharepoint versions.
          When you run the MSI file on the Sharepoint server it will let you choose to deploy only to specific Virtual Servers or you can deploy to all Virutal Servers on the server. The MSI will install all necessary files for the webpart and update the SafeControls list (in sharepoint’s web.config) allowaing the webpart to run.
          you can find more detailed information about the MSI created with WPPackager here http://msdn.microsoft.com/en-us/library/dd583150%28v=office.11%29.aspx

          1. I do not received any prompts to choose a Virtual Server as you indicate. It indicates that it is installing and after 10 seconds it dissapears. No further prompts or error messages. It shows up in Programs and Features (WinServ2008) but I don’t see it updating anything. Web.config is untouched. I am full admin on the 2008 server and Sharepoint Admin.

            And the WSP from the 2010 version will not work on 2007 for sure?

            Any suggestions? Thanks.

          2. Hi again,
            I’m not sure why the install is not working. I’ve installed it on many servers and usually had no problems.
            You could try to do a more manual install using STSADM.EXE to install the CAB file with the solution. You can download a ZIP containing the CAB file here.
            This is the same CAB file that WPPackager put into the MSI file you downloaded earlier.

            • Unpack the ZIP file somewhere on your Sharepoint server. Tha ZIP file contains one file, SubSites_www.sharepoint247.com.CAB
            • Run STSADM.EXE on your Sharepoint 2007 server with the following parameters:
            • stsadm -o addwppack -filename SubSites_www.sharepoint247.com.CAB -url http://your_Sharepoint_Portal_url_here -globalinstall -force
            • Then run ISSRESET to restart your webserver

            This should install the webpart on your Sharepoint server and it should be available when you try to add it to any page on your portal.

            As far as installing the 2010 WSP on a Sharepoint 2007 server I’m not sure. I don’t have a Sharepoint 2007 server available at the moment to try this.

  11. Hi there,

    Thanks for writing the Subsites tool. I downloaded it and it and in the zip file I found only subwebp.wsp? The file loaded succesfully but when I want to add it to a page I get:

    Display a list of subsites
    The file you imported is not valid. Verify that the file is a Web Part description file (*.webpart or *.dwp) and that it contains well-formed XML.

    Any Idea’s on where to look?

    Thanks,

    Gert-Wim

    1. Hi, are you installing this webpart on Sharepoint 2007 or Sharepoint 2010?
      the webpart is for Sharepoint 2010 and installing it on 2007 might give an error message like that.

      If you need a version for Sharepoint 2007 you can download this one. It’s the same subsites webpart but for Sharepoint Service 3.0 and Microsoft Office Sharepoint Server (MOSS) 2007

    1. The list of subsites is displayed in the order it’s returned from the GetSubwebsForCurrentUser method. I’m not sure if the the sites are sorted by created date by default.
      If not it would be possible to do so but the webpart does not have this option today.
      I will post the source code in the near future so if anyone want’s to add this functionality they may do so.

    1. Yes. It uses the GetSubWebsForCurrentUser method of the SpWeb object. This will only show subsites of which the current user is a member.

  12. Hi

    I used the webpart and deployed it to SP 2010 successfully. I am not able to see the new webpart in the gallery or in the webparts list when i try to add it to a page.
    am i missing something?

    Thx

      1. Hey. I’m having the same problem. Not showing up anywhere, and no custom category under webparts. Tried the add solution through powershell, and tried the 365 sandboxed file through adding solutions page. On Powershell I get no errors, and on the sandboxed solution page it adds but doesn’t let me activate.

        Really need this webpart, so any help would be really appreciated. I have a fresh install of Sharepoint 2010 Foundations. Thanks

Leave a Reply to Arild Aarnes Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.