Active Directory and LDAP

G

Guest

I need to retrieve a list of groups from Active Directory.
Then i need to retrieve a list of users from a group.

I'm unfamiliar with Active Directory objects.

Can i connect to Active Directory with LDAP, without specifying a particular
group?
How can i retrieve a list of groups?

thank you, -- i'm looking for any pointers.

CR
 
S

Siva M

These might help you get started:

http://msdn.microsoft.com/library/d...n-us/sds/sds/enumerating_users_in_a_group.asp

http://msdn.microsoft.com/library/d...n-us/sds/sds/enumerating_users_in_a_group.asp

http://msdn.microsoft.com/library/d...n-us/sds/sds/enumerating_users_in_a_group.asp

I need to retrieve a list of groups from Active Directory.
Then i need to retrieve a list of users from a group.

I'm unfamiliar with Active Directory objects.

Can i connect to Active Directory with LDAP, without specifying a particular
group?
How can i retrieve a list of groups?

thank you, -- i'm looking for any pointers.

CR
 
M

Marc Scheuner [MVP ADSI]

Can i connect to Active Directory with LDAP, without specifying a particular

Yes, of course. Have a look at the System.DirectoryServices namespace.
How can i retrieve a list of groups?

From here? The entire domain? A particular OU in your domain
hierarchy? You need to understand the AD structure (domains / OUs
etc.) in order to get an idea of where to begin.

Have a look at my BeaverTail ADSI Browser - it's C#, it's free, it
comes with full source code, and it will show you your AD structure,
LDAP paths, properties and their values and more.

http://adsi.mvps.org/adsi/CSharp/beavertail.html

If you want to bind to a specific OU and get all its groups, you'd do
something like this:

DirectoryEntry deMyOU = new
DirectoryEntry("LPAP://ou=MyOU,ou=ParentOU,dc=YourCOmpany,dc=com");

// enumerate children
foreach(DirectoryEntry deChild in deMyOU.Children)
{
if(deChild.SchemaClassname == "group")
{
// make a note of that group
}
}

Something like that. The more precise your questions, the more precise
our answers can be!

Also, you might want to scour the microsoft.public.adsi.general
newsgroup for the most competent AD gurus around - that's where you'll
get the best answers the quickest.

Marc

================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
 
G

Guest

Hi Marc,

Thank you for your help.

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....).
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 your response.

thank you,

CR
 
M

Marc Scheuner [MVP ADSI]

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?

Are you using a rich-client (Winforms app), or a web app (ASP.NET)?

In a rich-client environment, you might not even need to specify the
server to connect to - Windows will know by itself and find the best
server for you. Just specify the full valid LDAP path you want to bind
to, e.g.

LDAP://cn=TeamLeaders,ou=Groups,dc=YourCOmpany,dc=com

and you're done.

You might get more and more focussed answers in

microsoft.public.adsi.general

Cheers!

Marc
 

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