Show all subsites on a SharePoint 2010 page without code via SharePoint DesignerMarch 9th, 2012 | Posted by 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:
4)Click the “Connect now” button: SPD automatically adds the select statement, the WebsSoap port and GetWebCollection (if not, choose these values)
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
If you save the page and open it in your browser, you will see a list of subsites.
If you want the title to be clickable, click on the title and change the code
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>