Hi @sravya shivapuram ,
Based on my research and testing, you can following the code to get users from site group in SharePoint using CSOM:
static void Main(string[] args)
{
var clientContext = GetonlineContext();
Web oweb = clientContext.Web;
Group oGroup = clientContext.Web.SiteGroups.GetByName("Group_Name");
// Get collection of users in the above group
UserCollection oUserCollection = oGroup.Users;
// Load the user collection object
clientContext.Load(oUserCollection);
clientContext.ExecuteQuery();
// Iterate through each User
foreach (User oUser in oUserCollection)
{
Debug.WriteLine("User Name: " + oUser.Title);
}
}
My test result:
More information for reference:
https://www.codesharepoint.com/csom/get-all-users-from-site-group-in-sharepoint-using-csom
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.