L
LloydyJ89
Guest
Hi All, im hoping someone can help, i have manged to code a simple programme to query group membership. The code works and shows me AD groups however does not show me group membership which is shown in LDAP.
My code is below, hoping someone can help me
Thanks in advance
class Program
{
static void Main(string[] args)
{
UserPrincipal user = null;
string userName = "xxxxxxx";
// Console.WriteLine("userName");
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "domian address", "DC=xxx,DC=xxxxx,DC=xxxx,DC=xxxx");
{
if ((user = UserPrincipal.FindByIdentity(ctx, userName)) != null)
{
PrincipalSearchResult<Principal> groups = user.GetGroups();
foreach (GroupPrincipal g in groups)
{
Console.WriteLine(g.Name);
}
}
}
Console.ReadLine();
}
}
}
Continue reading...
My code is below, hoping someone can help me
Thanks in advance
class Program
{
static void Main(string[] args)
{
UserPrincipal user = null;
string userName = "xxxxxxx";
// Console.WriteLine("userName");
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "domian address", "DC=xxx,DC=xxxxx,DC=xxxx,DC=xxxx");
{
if ((user = UserPrincipal.FindByIdentity(ctx, userName)) != null)
{
PrincipalSearchResult<Principal> groups = user.GetGroups();
foreach (GroupPrincipal g in groups)
{
Console.WriteLine(g.Name);
}
}
}
Console.ReadLine();
}
}
}
Continue reading...