ADO and LDAP not working!!!! 
Author Message
 ADO and LDAP not working!!!!

hi,
    i'm creating a simple routine that given a name will check if it exist
as user in an Exchange server.
According to MS Exchange Developer kit  I've wrote this:

Public Sub Command1_Click()
Dim strADOQueryString As String  'ADO query String
Dim objADOconn As New ADODB.Connection 'ADO connection object
Dim objRS As New ADODB.Recordset 'Recordset object
Dim strCriteria As String         ' value for the search

On Error GoTo Cacata
    strDisplayName = "Recipients"
    strAliasName = "Recipients"
    strDirectoryName = "Recipients"
    strUserName = "cn=Administrator"
    'strUserName = "Administrator"
    strPassword = "admin"
    strServer = "FAXSRVDIR"
    strCriteria = "450"
    Set objADOconn = CreateObject("ADODB.Connection")
    objADOconn.Provider = "ADSDSOObject"
    objADOconn.Open "Active Directory Provider", strUserName, strPassword
    If objADOconn.State = adStateOpen Then
        MsgBox ("Connection open")
    Else
        MsgBox ("Connection Failed")
    End If
    strADOQueryString = "<LDAP://" + strServer +
">;(&(objectClass=organizationalPerson)(sn=" + strCriteria +
"));cn,adspath;subtree"
    Set objRS = objADOconn.Execute(strADOQueryString)
    If Not objRS.EOF Then
        MsgBox ("exist!!")
    Else
        MsgBox ("not exist")
    End If
    objRS.Close
Exit Sub
Cacata:
    MsgBox ("ERRORE!!")
End Sub

 I've tried with both VB5 and 6(since i wasn't sure that Exchange 5.5 was
"compatible with VB6)
With VB6 i got the objADOconn opened but then the query won't work, while
with VB5 I don't have even the objADOconn!! (it jump directly on the error
label!!).. could anybody tell me what I'm doing wrong?????
thx
Briz



Tue, 13 Nov 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ADO and LDAP not working!!

2. Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net

3. Working with LDAP

4. LDAP Provider don't work in this case

5. rs.Find not working in ADO

6. ADO SP ReturnValue Params not working and problems with Command.Append

7. ADO.NET problem: RejectChanges not Working

8. Output Parameter does not work through ADO.Net...?..!

9. ADO Code not working

10. Distributed app using ADO does not work on some Win98 machines

11. ADO - MoveFirst, MoveNext not working

12. ADO application does not work

 

 
Powered by phpBB® Forum Software