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

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

Eg.

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

How to achieve ?

share|improve this question
add comment

3 Answers 3

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
add comment

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
add comment
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
add comment

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.