示例
ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection");
GroupCollection collGroup = clientContext.Web.SiteGroups;
clientContext.Load(collGroup);
clientContext.Load(collGroup,
groups => groups.Include(
group => group.Users));
clientContext.ExecuteQuery();
foreach (Group oGroup in collGroup)
{
UserCollection collUser = oGroup.Users;
foreach (User oUser in collUser)
{
Console.WriteLine("Group ID: {0} Group Title: {1} User: {2} Login Name: {3}",
oGroup.Id, oGroup.Title, oUser.Title, oUser.LoginName);
}
}