View Site Groups In SharePoint 2010

using (SPSite siteCollection = new SPSite("http://hrweb"))
 {
   using (SPWeb site = siteCollection.OpenWeb())
     {
       // Print all groups name of site
       foreach (SPGroup group in site.Groups)
       {
          Console.WriteLine(group.Name);
        }
      Console.WriteLine("View All Site Groups");
 }
}

No comments:

Post a Comment