Iv'e been using the following code Visual Basic 6 code (see below) to access an Active Directory LDAP in the past with no problems. We have, however changed over to an Novell e-directory LDAP database and I can't get this code to work in a similar way on this LDAP database. Although its not giving an error, its not returning any values. Can anyone advise me on how to change the code to access a Non-microsoft LDAP such as e-directory? Is it possible and if so what modifications are required
desperately need a quick solution too this
Thanks in advance
Andy
' site number is not the real site here
Const LDAP_SERVERANDPORT = "LDAP://10.118.3.107:389"
Const LDAP_ENTRYPOINT = "LDAP://10.118.3.107:389/o=company/ou=users"
Const LDAP_USERNAME = "cn=username,ou=users,o=company"
Const LDAP_PASSWORD = "passwordxxx"
Private mstrChristianName As String
Private mstrSurname As String
Public Function GetUserDetails(ByVal strUser As String) As Boolean
Dim objConn As New Connection
Dim objCommand As New Command
Dim SQLStmt As String
Dim objConnStr As String
Dim rs As Recordset
Set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADSDSOObject"
objConn.Properties("Data Source") = LDAP_SERVERANDPORT
objConn.Properties("User ID") = LDAP_USERNAME
objConn.Properties("Password") = LDAP_PASSWORD
objConn.Properties("Encrypt Password") = False
objConn.Open "ADs Provider"
' Create the objConnection and command object.
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConn
SQLStmt = "SELECT givenName FROM '" + LDAP_ENTRYPOINT + "' WHERE objectClass='companyUser' and cn='" + strUser + "'"
objCommand.CommandText = SQLStmt
Set rs = objCommand.Execute
If Not (rs.EOF And rs.BOF) Then
mstrChristianName = rs("givenName")
Else
GetUserDetails = False
End If
objConn.Close
Set objConn = Nothing
End Function
Public Property Get ChristianName() As String
ChristianName = mstrChristianName
End Property
desperately need a quick solution too this
Thanks in advance
Andy
' site number is not the real site here
Const LDAP_SERVERANDPORT = "LDAP://10.118.3.107:389"
Const LDAP_ENTRYPOINT = "LDAP://10.118.3.107:389/o=company/ou=users"
Const LDAP_USERNAME = "cn=username,ou=users,o=company"
Const LDAP_PASSWORD = "passwordxxx"
Private mstrChristianName As String
Private mstrSurname As String
Public Function GetUserDetails(ByVal strUser As String) As Boolean
Dim objConn As New Connection
Dim objCommand As New Command
Dim SQLStmt As String
Dim objConnStr As String
Dim rs As Recordset
Set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADSDSOObject"
objConn.Properties("Data Source") = LDAP_SERVERANDPORT
objConn.Properties("User ID") = LDAP_USERNAME
objConn.Properties("Password") = LDAP_PASSWORD
objConn.Properties("Encrypt Password") = False
objConn.Open "ADs Provider"
' Create the objConnection and command object.
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConn
SQLStmt = "SELECT givenName FROM '" + LDAP_ENTRYPOINT + "' WHERE objectClass='companyUser' and cn='" + strUser + "'"
objCommand.CommandText = SQLStmt
Set rs = objCommand.Execute
If Not (rs.EOF And rs.BOF) Then
mstrChristianName = rs("givenName")
Else
GetUserDetails = False
End If
objConn.Close
Set objConn = Nothing
End Function
Public Property Get ChristianName() As String
ChristianName = mstrChristianName
End Property