Tuesday, December 29, 2015

How to retrieve all Users in SharePoint Group using CSOM?

ClientContext ctxcontext = new ClientContext("http://peakfinders/");

 

GroupCollection ctxgroup = ctxcontext.Web.SiteGroups;

 

// Assume that there is a "Manager" group, and the ID=2.

Group strgroup = ctxgroup.GetById(2);

ctxcontext.Load(strgroup.Users);

ctxcontext.ExecuteQuery();

 

foreach (User ouser in strgroup.Users)

{

 

console.WriteLine(ouser.Title);

}

No comments:

Post a Comment