Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Retrieving All Users From A SharePoint Group Using CSOM
WhatsApp
Gowtham Rajamanickam
8y
33.6
k
0
0
25
Blog
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.
CSOM
SharePoint
Up Next
Get Group Users Using CSOM
Ebook Download
View all
Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS
Read by 4.9k people
Download Now!
Learn
View all
Membership not found