Question

Is there any way to know the total number of sites in a site collection? Any tool to how the tree of sites with total number of sites or something similar?

Was it helpful?

Solution

SPSite.AllWebs.Count

SPSite.AllWebs returns ALL sites (flattened) in a site collection, regardless of their level.

OTHER TIPS

You can use the Webs Web Service and jQuery to get the enumeration of all of the subwebs using the GetAllSubWebCollection operation. The nice things about this approach:

  • You can do it all client-side
  • You can format the output however you'd like

Check out my jQuery Library for SharePoint Web Services to make this easy.

You can use stsadm -o enumsubwebs but you way have to run this recursively. In the past I've written some recursive functions using the api that grabs the info, but you need to be careful where you run that sort of script.

This free reporting tool from Quest will give you a site count and fair bit more besides.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top