0

I'm trying to fetch data from OID(oracle internet dictionary) LDAP using Excel. Below is the code i have wrote but still its not fetching the data.

Public Function RegUsers()

    Dim conn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim isLDAPUserFound As Boolean
    Dim str_UserId As String

    Try

        conn = New ADODB.Connection
        conn.Provider = "ADSDSOObject"
        conn.Open

        isLDAPUserFound = False
        str_UserId = "abc123"

        If isLDAPUserFound = False Then

            rs = conn.Execute("<LDAP://url:port/o=xyzx>;" & "(uid=" & str_UserId & ");uid,mail,CN;subtree")

            If Not rs.BOF Then
                isLDAPUserFound = True
                MsgBox("Something Fonund")
            End If

        End If

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try


End Function

Please help me sort this problem.

Note : I have doubt about provider name and should we give system account which is having LDAP admin privileges if yes where should we mention.

Community
  • 1
  • 1
Ashwin
  • 245
  • 2
  • 7
  • 22
  • Check http://stackoverflow.com/questions/1090336/querying-active-directory-using-vbscript, http://stackoverflow.com/questions/21110232/getting-ad-details-based-on-username and http://ss64.com/vb/syntax-ad.html. It is VBScript, however the syntax is almost the same as in VBA. – Wernfried Domscheit Nov 25 '16 at 15:18
  • ` isLDAPUserFound = False If isLDAPUserFound = False Then` Would this condition not always be true as you set it lines above? If you place a break point and watch when you define the recordset what does `rs` populate with? Also check your query string before excuting (ie in a MsgBox). Test this query directly in Oracle to confirm it returns any rows. – nbayly Nov 25 '16 at 18:07
  • getting "Login failure unknown user name or bad password." Where should we mention sys admin user ID and password?? – Ashwin Nov 28 '16 at 14:25

0 Answers0