Steps
  1. Open Visual Studio in your system.
  2. Select Console Application template and give the name.
  3. Add a Microsoft.Client Assembly reference file in right side reference tab in Visual Studio.
  4. Replace Program.cs with the source code given below.
Code snippet
  1. using System;
  2. using Microsoft.SharePoint.Client;
  3. namespace GowthamArticles
  4. {
  5. class retrivegroup
  6. {
  7. static void Main()
  8. {
  9. ClientContext clientContext = new ClientContext("https://gowtham.sharepoint.com/tutorials");
  10. GroupCollection collGroup = clientContext.Web.SiteGroups;
  11. Group getGroup = collGroup.GetById(5);
  12. UserCollection collUser = getGroup.Users;
  13. clientContext.Load(collUser);
  14. clientContext.ExecuteQuery();
  15. foreach (User getUSer in collUser)
  16. {
  17. Console.WriteLine("User: {0} Email: {2} Login Name: {3}",
  18. getGroup.Title, getGroup.Email, getGroup.LoginName);
  19. }
  20. }
  21. }
  22. }
Thanks for reading my blog.