LDAP

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
 
O

Ollie Riches

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
 
G

Guest

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!
 
O

Ollie Riches

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

Ollie Riches
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top