Show all subsites on a SharePoint 2010 page without code via SharePoint Designer

March 9th, 2012 | Posted by Marijn in code | sharepoint designer | xsl

I was looking for an easy way to display a list of subsites in SharePoint 2010 and I couldn’t find it. It seemed you could only do that with some webparts or heavy use of custom code.

Then I found Michael Wilcox blog who explains how to do it in SharePoint 2007 and I decided to give it a try if it still works in SP2010.

The trick is simple: we are going to use the build-in webservice without writing a single line of code:

1)Open the site in SharePoint Designer.

2)Go to the Data Sources block and click on the button SOAP Service Connection

3)Add the link to your site in the field “Service description location” and add the part: _vti_bin/Webs.asmx?WSDL
This will give you a link like this:
http://yoursitecollection/sites/yoursite/_vti_bin/Webs.asmx?WSDL

4)Click the “Connect now” button: SPD automatically adds the select statement, the WebsSoap port and GetWebCollection (if not, choose these values)

5)Click “ok”

6)Go to the page where you want to add the list in SharePoint Designer. On the insert tab, add a Data View with the SOAP Services connection we just made
Done!

If you save the page and open it in your browser, you will see a list of subsites.

Optionally:
If you want the title to be clickable, click on the title and change the code

<xsl:value-of select="@Title">

To following code:

<xsl:element name="a">

<xsl:attribute name="href">

<xsl:value-of select="@Url"/>

</xsl:attribute>

<xsl:value-of select="@Title"/>

</xsl:element>

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

8 Responses

  • Suzanne says:

    Thanks very much! I’d been looking for this solution for some time. Works like a charm.

  • Chris says:

    SOAP Service Connection (nor any other service) is an option for me. Under Data Sources, all I have are the lists and libraries on the site. Any idea why? I’m a site collection admin, but have no more rights than that.

  • Chris says:

    *facepalm* Nevermind…there it is. Maybe if I got my palm OUT of my face…

  • Pamela says:

    Thank you! This solution is simple and works great.

  • ganbingjie@163.com says:

    Thank you! This solution works very well and it’s very easy. but it’s only list of the subsite, how about sub-subsite? or sub-sub-subsite?

    • Marijn says:

      You will need a bigger script for that 😉
      I can’t really help you with that, but I am sure if you ask twitter “#sphelp” channel or some other forum, there will be people that will help you!

  • mini says:

    Thank you…

  • Dan says:

    It was going so well… until the part where you insert the data source. In SharePoint Designer 2013 there is no “Design View” – which I assume is how you did it. I tried adding it in “Code View” but got an error on the right hand side: “The serer returned a non-specific error”

    Back to google…



Leave a Reply

%d bloggers like this: