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.