EDN Admin
Well-known member
Hi There,
I am new to C# Asp.Net. and i have a project. A part of my project is to populate a gridview with all the users of an OU in Active Directory. here is what i got.
public GroupPrincipal GetGroup(string sGroupName)
{
PrincipalContext oPrincipalContext = GetPrincipalContext();
GroupPrincipal oGroupPrincipal = GroupPrincipal.FindByIdentity(oPrincipalContext, sGroupName);
if (oGroupPrincipal.Name.ToString() == null)
{
lblGroupName.Text = "None";
}
else
{
foreach (Principal p in oGroupPrincipal.GetMembers(true))
{
//here is where i got stucked. I think i need to create a datatable here and populate my gridview
// using the dt. but i dont know how to.
}
lblGroupName.Text = oGroupPrincipal.Name.ToString();
}
return oGroupPrincipal;
}
Thanks in advance Guys!
View the full article
I am new to C# Asp.Net. and i have a project. A part of my project is to populate a gridview with all the users of an OU in Active Directory. here is what i got.
public GroupPrincipal GetGroup(string sGroupName)
{
PrincipalContext oPrincipalContext = GetPrincipalContext();
GroupPrincipal oGroupPrincipal = GroupPrincipal.FindByIdentity(oPrincipalContext, sGroupName);
if (oGroupPrincipal.Name.ToString() == null)
{
lblGroupName.Text = "None";
}
else
{
foreach (Principal p in oGroupPrincipal.GetMembers(true))
{
//here is where i got stucked. I think i need to create a datatable here and populate my gridview
// using the dt. but i dont know how to.
}
lblGroupName.Text = oGroupPrincipal.Name.ToString();
}
return oGroupPrincipal;
}
Thanks in advance Guys!
View the full article