To get a list of all subsites in a site you can run the following pattern:
using (SPSite site = new SPSite(“[YOUR SITE COLLECTION URL]“))
{
using (SPWeb web = site.RootWeb)
{
foreach (SPWeb subWeb in web.Webs)
{
// Do your thing…
}
}
}
No related posts.
Posted under Developer
This post was written by furuknap on December 9, 2008
