ADODB on Exchange 2000 and 2003

  • From: "Reno" <>
  • To: exchangelist@xxxxxxxxxxxxx
  • Date: Mon, 3 Oct 2005 01:30:54 -0600

I developped an interface which aims to synchronize Exchange items with an
SQL Server database. This is a VB .Net console application that uses ADO
2.5 (Microsoft ActiveX Data Objects 2.5 Library) and CDO (Microsoft CDO
For Exchange 2000 Library). Exchange items updates are done thanks to an
ADO dynamic cursor on a DAV query.
The only testing environment I can use is a Windows 2003 Server with
Exchange 2003, whereas the final server is Windows 2000 Server with
Exchange 2000.
The result is that my app works fine on WS2003 but it crashes on WS2000,
when trying to fetch ADO recordset (code bellow). I 've been careful not
to use WS2003 or Exchange 2003 libs, but it seems that this wasn't
sufficient to ensure compatibility.
Can I get this code to work by updating WS2000 or changing ADO references
or am I totally wrong ? ...
Thanx a lot.

Module Module1

   Sub Main()
      Dim lcnCnx As ADODB.Connection
      Dim lrsClientItems As New ADODB.Recordset
      Dim lsSourceQuery As String
      Dim lsFolder As String = InputBox("Folder URL?", ,

         lcnCnx = GetExchangeConnection(lsFolder)

         lsSourceQuery = "SELECT ""DAV:displayname""" _
         & " FROM scope('shallow traversal of """ _
         & lsFolder _
         & """')"

         lrsClientItems.Open( _
            lsSourceQuery, _
            lcnCnx, _
            ADODB.CursorTypeEnum.adOpenDynamic, _
            ADODB.LockTypeEnum.adLockUnspecified, _

         While Not lrsClientItems.EOF
            lrsClientItems.MoveNext() 'Crashes on Windows 2000 Server with
Exchange 2000
         End While
      Catch ex As Exception
         System.Console.WriteLine("ERROR: " & ex.Message)
      End Try
   End Sub

   Private Function GetExchangeConnection(ByVal psUrl As String) As
      Dim lcnConnection As New ADODB.Connection

      lcnConnection.Provider = "ExOLEDB.DataSource"
      GetExchangeConnection = lcnConnection
   End Function
End Module

Other related posts: