Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

get users from SP Domain Group

  Asked By: Colt Golden         Date: Aug 02, 2005      Category: Sharepoint      Views: 479

I have successfully pulled the users information into a Web part;
their email, user name, etc ... but when the 'user' is an active
directory security group, it shows the name of the group only and
not the individual members of that group. My code looks like this:

SPSite siteCollection = SPControl.GetContextSite(Context);
SPWeb site = siteCollection.AllWebs[""];
SPUserCollection users = site.Users;

try{
foreach (SPUser user in users)
{
if (user.IsDomainGroup == true)
{
(output.Write( user.Name + " is a SharePoint Group <br />");
}
else
{
output.Write("User: " + (user.Name)
+ "      ");
output.Write("<a href='http://servername/MySite/Public.aspx?
accountname=" + user.LoginName + " '>Personal Site </a> <br />");
output.Write("E-Mail: " + (user.Email ) + "<p />");
}
}
}
catch(Exception excpt)
{
output.Write(excpt.ToString());
}

anyone have a code snippett to extract the individual users from the
domain group?


Do you know someone who can help? Share a link to this thread on twitter, or facebook.

Tagged:            

 

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

 
Didn't find what you were looking for? Find more on get users from SP Domain Group Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].