Re: LDAP binding
From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: Fri, 23 Jul 2004 09:26:53 -0500
You just need to know the names of the attributes that store those values. Based on the syntax you have below, you can get the additional values using the same syntax as you used for displayName.
I'd suggest using a tool like ldp.exe or ADSI Edit to view all of the available AD data for a user and figure out what all the attribute names are. Then, you can translate that to your code.
If you want to do queries against AD instead of binding to specific objects, you should use the DirectorySearcher.
Most of the support for this stuff goes on in microsoft.public.adsi.general (.NET and COM). Also, there's good stuff in the Directory Services SDK documentation in MSDN.
"Mike" <email@example.com> wrote in message news:eJwgGsGcEHA.4032@TK2MSFTNGP11.phx.gbl...
Thanks Joe. I can now see the various properties.
Is there a possibility to query the Active Directory to gather some information about the user (group, phone, etc.)? How can I do that?
"Joe Kaplan (MVP - ADSI)" <firstname.lastname@example.org> wrote in message news:eY5PbwDcEHA.3460@TK2MSFTNGP10.phx.gbl...
In order to use an unqualified username, you must specify AuthenticationTypes.Secure (which you should do anyway to ensure that your credentials are encrypted on the network). You can also use the upn syntax (email@example.com) or NT Logon format (domain\user) with or without AuthenticationTypes.Secure.
"Mike" <firstname.lastname@example.org> wrote in message news:OTui1IDcEHA.2008@TK2MSFTNGP10.phx.gbl...
I am trying to bind to an Active Directory server using the following snippet, but I always get a user unknown or bad password error message.
DirectoryEntry de = new DirectoryEntry(LDAP://srv-dell.waysoft.local);
de.AuthenticationType = AuthenticationTypes.ServerBind;
de.Username = "administrator";
de.Password = "password";
string usr = de.Properties["DisplayName"].Value.ToString(); // the error message appears here
Any idea of what is wrong?