Programmatically getting Allwebs


 public void GetAllwebs(string SiteUrl)
        {
            try
            {              
                using (SPSite osite = new SPSite(SiteUrl))
                {
                    Allwebs.Clear();
                    SPWebCollection owebcoll = osite.AllWebs;
                    foreach (SPWeb oweb in owebcoll)
                    {
                        Allwebs.Add(oweb.Url);
                       
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell