Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 275262 - Last Review: July 28, 2004 - Revision: 2.1
How to retrieve Exchange and Outlook data with the Jet 4.0 OLE DB provider in Access 2000
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).
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.
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 = "Microsoft.JET.OLEDB.4.0"
.ConnectionString = "Exchange 4.0;" _
& "MAPILEVEL=Mailbox - James Smith|;" _
& "PROFILE=MS Exchange Settings;" _
& "TABLETYPE=0;DATABASE=C:\WINDOWS\TEMP\;"
.Open
End With
With ADORS
.Open "Select * from Calendar", 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:
Note that the name of the first contact in your contacts folder
appears in the Immediate window.
APPLIES TO
- Microsoft Access 2000 Standard Edition
| kbhowto kbprovider kbdatabase kbprogramming kbado kbvba KB275262 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate