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