Khalid Mehmood Awan
asked on
Outlook "Check Names" feature in visual basic.net or C#
- First check out the image attached.
- Suppose I have an asp.net form containing a text field and a button and a list box. I type my windows user name (or part of user name) in the text field and then press button. What i want is that it should check what ever is in text field when i hit button and try to match all email addresses or user names in domain active directory and display their email addresses in list box. Otherwise it should return "no user match".
Screenshot.JPG
- Suppose I have an asp.net form containing a text field and a button and a list box. I type my windows user name (or part of user name) in the text field and then press button. What i want is that it should check what ever is in text field when i hit button and try to match all email addresses or user names in domain active directory and display their email addresses in list box. Otherwise it should return "no user match".
Screenshot.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
Public Shared Function AuthenticateUserPassword(B
Dim result As Boolean = False
Dim szUserDomain As String = ""
Dim myLDAPPath As String
' Determine what the domain name should be.
If szUserName.Contains("\") Then
' Pull the domain out of the user name.
szUserDomain = szUserName.Substring(0, szUserName.IndexOf("\"))
' Set user name to just user name.
szUserName = szUserName.Substring(szUse
ElseIf szUserName.Contains("@") Then
' User Name is in form of "user@domain"
' Pull the domain out of the user name.
szUserDomain = szUserName.Substring(szUse
' Set user name to just user name.
szUserName = szUserName.Substring(0, szUserName.IndexOf("@"))
Else
' A "." refers to the local system.
szUserDomain = Environment.MachineName
szUserName = szUserName.Substring(szUse
End If
' Determine which entry it will need to be.
If String.Compare(szUserDomai
myLDAPPath = "WinNT://" & szUserDomain
Else
myLDAPPath = "LDAP://" & szUserDomain
End If
Try
Dim entry As DirectoryEntry = New DirectoryEntry(myLDAPPath,
Dim nativeObject As Object = entry.NativeObject
result = True 'no exception thrown, user must exist
nativeObject = Nothing 'be sure and clean up these object as this service could be used many times
entry = Nothing
Catch ex As Exception
result = False 'exception thrown - no user with that name/pwd combination
End Try
Return result
End Function
Open in new window