Microsoft KB Archive/275262

= How to retrieve Exchange and Outlook data with the Jet 4.0 OLE DB provider in Access 2000 =

Article ID: 275262

Article Last Modified on 7/28/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q275262



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article describes how you can open a connection to a Microsoft Exchange or to a Microsoft Outlook mailbox by using ActiveX Data Objects (ADO) and the Jet OLE DB provider.



MORE INFORMATION
The following example opens a connection to an Exchange or to an Outlook mailbox, and then prints out the subject and the date received values of the first record in the Calendar.

NOTE: Steps 1 through 3 show you how to determine the name of your mailbox. If you already know the name of your mailbox, go to step 4.  Click Start, point to Settings, and then click Control Panel. In Control Panel, open the Mail tool. Click the Delivery tab to see the list of available mailboxes. Your mailbox name is in the Deliver new mail to the following location box.  In an Access database, create a new module, and then paste or type the following code.

NOTE: In the connection string, change the name James Smith to your mailbox name, and make sure the path to the Temp folder is correct for your system. Keep in mind that the spaces, the minus sign, and the vertical bar character are required in the string. Sub OpenExchange_Calendar Dim ADOConn As ADODB.Connection Dim ADORS As ADODB.Recordset Dim strConn As String Set ADOConn = New ADODB.Connection Set ADORS = New ADODB.Recordset With ADOConn .Provider = &quot;Microsoft.JET.OLEDB.4.0&quot; .ConnectionString = &quot;Exchange 4.0;&quot; _ & &quot;MAPILEVEL=Mailbox - James Smith|;&quot; _ & &quot;PROFILE=MS Exchange Settings;&quot; _ & &quot;TABLETYPE=0;DATABASE=C:\WINDOWS\TEMP\;&quot; .Open End With With ADORS .Open &quot;Select * from Calendar&quot;, ADOConn, adOpenStatic, _ adLockReadOnly .MoveFirst Debug.Print ADORS(3).Name, ADORS(3).Value Debug.Print ADORS(10).Name, ADORS(10).Value .Close End With Set ADORS = Nothing ADOConn.Close Set ADOConn = Nothing

End Sub   In the Immediate window, type the following line, and then press ENTER: OpenExchange_Calendar 

Note that the name of the first contact in your contacts folder appears in the Immediate window.

Keywords: kbhowto kbprovider kbdatabase kbprogramming kbado kbvba KB275262

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.