Question

I see that this has been asked quite a few times but I think I'm taking a different approach to the problem. I have an LDAP connection string that is working - it connects to a group. Something like the following:

var myGrp = new DirectoryEntry("LDAP://server.domain.com:389/CN=GroupName,OU=RAM,OU=Groups,DC=region,DC=company,DC=com");
            myGrp.Username = "username";
            myGrp.Password = "password";

Now, I can print myGrp.Name without any issues. I would now like to list all members of this group, but I'm not sure where to begin. Any pointers would be awesome.

Was it helpful?

Solution

I tried this and it worked perfectly:

foreach (object dn in myGrp.Properties["member"])
            {
                Console.WriteLine(dn);
            }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top