Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

4 Answers 4

up vote 4 down vote accepted
SPSite.AllWebs.Count

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

share|improve this answer

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

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

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

 
discard

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.