SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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

share|improve this answer

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.

share|improve this answer
I hadn't considered using it in this way. Interesting idea. – Mike Oryszak Jan 30 '10 at 22:27

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.

share|improve this answer
What I need is a tool or a script to give me the total in one shot if possible. – Emad Jan 30 '10 at 21:11

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

share|improve this answer
When I tried to download this toolset, the site asked me for a bunch of info and said I'd be contacted by a salesperson. Certainly not my goal. Maybe I missed something? – Marc D Anderson Jan 31 '10 at 15:41
I'm sorry to hear that, Marc. All I can say is that it worked fine for me - I wasn't asked for a bunch of info and I wasn't told I'd be contacted by a salesperson. – Anonymous Feb 1 '10 at 2:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.