Syntax for linking contacts in Public Folders to Access

I

Italian Pete

Hi,
I'm trying to import specific fields from a contact list in Public
Folders\All Public Folders into Access.
The code I'm using looks something like this:

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=Public Folders|All Public
Folders\PetesFolder\Contacts;" _
& "PROFILE=Outlook;" _
& "TABLETYPE=1;DATABASE=C:\WINDOWS\TEMP\;"
.Open
End With

With ADORS
.Open "Select * from Contacts", ADOConn, adOpenStatic, _
adLockReadOnly

.MoveFirst
Do While Not .EOF
Dim i As Long
For i = 0 To ADORS.Fields.Count - 1
Debug.Print ADORS(i).Name, ADORS(i).Value
Next i
.MoveNext
Loop
.Close
End With

Set ADORS = Nothing
ADOConn.Close
Set ADOConn = Nothing

End Sub


However, I am getting an error. I suspect this is due to the syntax of the
string directly after MAPILEVEL.

Is this the case and if so, what should the syntax be?

many thanks,

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top