LDAP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to retrieve a list of all the groups from Active Directory, so
e.g. (Team Leaders, Accounts, Development etc). ( I am going on the
assumption that email groups are the same as active directory groups...is
this right?.). If not, how do i get the kinds of groups i describe?

I'm working on an Human Resources app that needs to retrieve all groups and
the users that belong to those groups.

Where do I need to connect my DirectoryEntry.Path to in order to retrieve
this information? The server on which active directory is located?, the
domain of my company?

I would be very grateful for any response.

CR
 
First off you are best asking quesiotn about LDAP and AD in the following
newsgroups where the 'two joes' will given you the most definite answer.

microsoft.public.active.directory.interfaces
microsoft.public.adsi.general

But the following code shoudl give all the groups:

System.DirectoryServices.DirectoryEntry entry = new
System.DirectoryServices.DirectoryEntry(LDAP://CN=Users,DC=XXXX,DC=com);
foreach(System.DirectoryServices.DirectoryEntry child in entry.Children)
{
if(child.SchemaClassName == "group")
Console.WriteLine(child.Name.ToString());
}

Don't forget to change the 'XXXX' for AD domain name

HTH

Ollie Riches
 
Hi Ollie,

thank you - I see what you are getting at.
Howerver I need to connect to a server(not a domain) and I want to connect
to a particular user group e.g. IT Administrators.

thank you!
 
do you mean local groups on a server (phyiscal machine) or groups in an AD?
becuase you keep asking questions about AD.

Ollie Riches
 
Back
Top