accessing Exchange Class via LDAP and ADO

accessing Exchange Class via LDAP and ADO

Post by twf » Sat, 29 May 1999 04:00:00



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

 
 
 

accessing Exchange Class via LDAP and ADO

Post by Jamie Vacho » Sat, 29 May 1999 04:00:00


A couple of questions... When you say the query didn't work in VB5,
what happened? Also, what version of ADSI are you running? Have
you installed the newest MDAC?

--
Jamie Vachon
Developer, Collaboration Group
Corporate Software & Technology


>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


 
 
 

accessing Exchange Class via LDAP and ADO

Post by twf » Sat, 29 May 1999 04:00:00


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

 
 
 

accessing Exchange Class via LDAP and ADO

Post by twf » Tue, 01 Jun 1999 04:00:00


1- in VB5 i don't even reach the instruction "Set objRS =
objADOconn.Execute(strADOQueryString)"
     because it fails before at the instruction " objADOconn.Open "Active
Directory Provider", strUserName, strPassword", while with VB6 I 'm able to
open the connection, but the "Execute" instruction doesn't return me a
"True" answer ( and it should since the name exist as exchange user)
2- I'm using what is installed with the VB version ( got a machine with dual
boot NT4 SP3 OP4, one with VB5 and one with VB6)
FZ


> A couple of questions... When you say the query didn't work in VB5,
> what happened? Also, what version of ADSI are you running? Have
> you installed the newest MDAC?

> --
> Jamie Vachon
> Developer, Collaboration Group
> Corporate Software & Technology


> >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

 
 
 

1. Accessing via ADO and LDAP

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

2. SOS pb with Wordmail when I load Exhange

3. Accessing properties of Report.IPM.Note.NDR objects via ADO

4. How to control & disable rules wizard in OL2000 and Exchange 5.5?

5. Unable to access web storage system via http/ ado

6. installing exchange 2000 on a member server in our domain

7. Connection String for Data Access via ADO / HTTP

8. Send/Receive

9. Accessing attachments via ADO

10. Accessing TASKS in a private mailbox via ADO/CDOEX

11. Access Public Folder ACL via ADO

12. accessing DAV:href property via ADO

13. Accessing Exchange Directories via LDAP