Re: LDAP, Email
- From: Dianna <Dianna@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 6 Apr 2006 06:40:02 -0700
Thanks Joe and Henning,
I will look further into this.
"Joe Kaplan (MVP - ADSI)" wrote:
It is a little cleaner to actually specify the default naming context of the.
domain as the search root explicitly instead of trying to rely on ADSI to
figure that out for you. I'd also recommend against using NETBIOS names for
AD. DNS is always better. I'd do this (works in 1.1 or 2.0; 2.0 has other
better options as well):
Dim rootDSE as DirectoryEntry = New
DirectoryEntry("LDAP://abc.xxx.xxx/RootDSE")
dnc = DirectCast(rootDSE.Properties("defaultNamingContext").Value, String)
oDS = New DirectoryEntry("LDAP://abc.xxx.xxx/" + dnc)
And proceed from there.
Another thing to consider is that you are using default credentials in your
bind. If your current security context is not a domain identity or cannot
be delegated, you might be authenticating with the server as an anonymous
user and might therefore not have permissions to see anything. If you
suspect that is true, try changing your DirectoryEntry constructor to supply
some know good credentials for testing. If that fixes it, then you know you
have a security problem.
Joe K.
"Dianna" <Dianna@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:71E8401D-7DD8-4C6A-A395-E8141BBC425B@xxxxxxxxxxxxxxxx
Hi Henning,
_path = LDAP://
_domain = ABC
so it looks like LDAP://ABC
The user name is the Windows it ex: ABC/jsmith
"Dianna" wrote:
Hi,
I am trying to retrieve the email from AD for a specific user, I am
getting
no results. The below code sends in a username that has an email address:
Dim oDS As New DirectorySearcher(_path & _domain)
oDS.Filter = "(samAccountName=" + Username + ")"
oDS.PropertiesToLoad.Add("mail")
Dim res As SearchResult = oDS.FindOne()
Dim strEmail As String
If Not IsNothing(res) Then
Dim deUser As DirectoryEntry = res.GetDirectoryEntry()
strEmail = deUser.Properties("mail").Value.ToString()
End If
What am I doing wrong. I'm very new to LDAP, but the above seems simple
enough...?
Thanks,
Dianna
- Follow-Ups:
- Re: LDAP, Email
- From: Dianna
- Re: LDAP, Email
- References:
- Re: LDAP, Email
- From: Joe Kaplan \(MVP - ADSI\)
- Re: LDAP, Email
- Prev by Date: Re: overriding CreateParams in a control hosted in HTML
- Next by Date: Re: Check calling app in a remote object
- Previous by thread: Re: LDAP, Email
- Next by thread: Re: LDAP, Email
- Index(es):
Relevant Pages
|
|