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

I want to get all webs including it's subwebs.


  1. Site
    1. web1
      1. subweb1
      2. subweb2
    2. web2

How to achieve ?

share|improve this question

Its all happening in SharePoint Manager, just download source code and look at code to get what you want.

Hope it helps :).

share|improve this answer

you can use WebsInfo property of SPWebCollection class

var list = SPContext.Current.Site.AllWebs.WebsInfo;

then you can perform action with SPWebInfo class.

share|improve this answer
up vote 0 down vote accepted

This is one solution, which will return all sites including its subsite.

SPWebCollection allwebcoll = spsite.AllWebs;
share|improve this answer
mark it as answer. – Falak Mahmood Jan 5 '13 at 17:10

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.