Retrieving All Users From A SharePoint Group Using CSOM

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.   
  4.   
  5. namespace GowthamArticles  
  6. {  
  7.     class retrivegroup  
  8.     {  
  9.         static void Main()  
  10.         {     
  11.             ClientContext clientContext = new ClientContext("https://gowtham.sharepoint.com/tutorials");  
  12.             GroupCollection collGroup = clientContext.Web.SiteGroups;  
  13.             Group getGroup = collGroup.GetById(5);  
  14.             UserCollection collUser = getGroup.Users;  
  15.             clientContext.Load(collUser);  
  16.             clientContext.ExecuteQuery();  
  17.             foreach (User getUSer in collUser)  
  18.             {  
  19.                 Console.WriteLine("User: {0} Email: {2} Login Name: {3}",   
  20.                 getGroup.Title, getGroup.Email, getGroup.LoginName);  
  21.             }  
  22.   
  23.      
  24.               
  25.         }  
  26.     }  
  27. }  
Thanks for reading my blog. 
Next Recommended Reading Get Group Users Using CSOM