Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How I get specific group members?

  Asked By: Palak    Date: Sep 03    Category: Sharepoint    Views: 1513

I want to make a web part.
Group owner want to see his own members.
but I got errors....
any help?
---------------------

MembershipUserCollection users = new MembershipUserCollection() ;
MembershipUser user;

SPUser spuser = SPContext.Current.Web.CurrentUser;
SPGroupCollection spgroups = spuser.OwnedGroups;

foreach (SPGroup group in spgroups)
{
string groupname = group.Name;
foreach (SPUser groupuser in group.Users)
{
string memberloginName = groupuser.LoginName;
user = Membership.GetUser(memberloginName);
users.Add(user);

}

}

MemberGrid.DataSource = users;
MemberGrid.DataBind();

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How I get specific group members? Or get search suggestion and latest updates.




Tagged: