Monday, June 22, 2009

making pages containing lists of sites, lists

One of the projects I am working on needed some pages containing lists of subsites and lists of lists. Some examples include:

  • A top-level site that has lots of blog sites beneath it. The user wants a list of all of the blog sites to appear in a web part on the top level site.
  • A top-level site that has lots of discussion boards contained within it. The user wants a list of all of the discussion boards inside this site.


Note that top-level in this case does not necessarily mean a site collection.

I could not find a built-in web part to accomplish this. However, it is very straighforward to create a DVWP (i.e. data view web part) talking to built-in WSS web services. This is done using SharePoint Designer. Here is the process:

  • create a web part page (Site Actions >> Create >> Web part page)
  • open the page in SPD (use either Design or Split view)
  • Data View >> Manage Data Sources
  • In the Data Source Library, select Connect to a web service

Here the directions will be slightly different for sites vs. lists

For Sites:

  • use http://<your site>/_vti_bin/webs.asmx for sub-sites
  • use the GetWebCollection method
  • after creating this data source, drag it into one of the web part zones on the new page (this creates a DVWP)
  • use the context menu ">" and season to taste

For Lists:
  • use http://<your site>/_vti_bin/lists.asmx for containing lists
  • use the GetListCollection method
  • after creating this data source, drag it into one of the web part zones on the new page (this creates a DVWP)
  • use the context menu ">" and season to taste

Good luck!

No comments:

Post a Comment