V
Vaughan
I borrowed some code I found referenced on here and came up with a version of
my own (listed below) to pull data from an Outlook folder into Access. I
don't really know what I'm doing though, and I'm struggling to find the ADO
connection string syntax to vary the code to fit what I want.
This code does pull in the specified data, but I want to access data in
other folders; e.g.: 'Mailbox - Vaughan Davies\Projects\Financials' or in a
public folder. I have tried:
"MAPILEVEL=Mailbox - Vaughan Davies|Projects|Financials;"
"MAPILEVEL=Mailbox - Vaughan Davies|Projects\Financials;"
"MAPILEVEL=Mailbox - Vaughan Davies\Projects\Financials;"
"MAPILEVEL=Mailbox - Vaughan Davies/Projects/Financials;"
... and every combination of "/", "|" & "\" but can't make it work.
** Can anyone point me to a reference on ADO connection string syntax that
might cover this aspect. **
** Also, the data returned seems to be that shown in the currrent view of
the folder. Can another view be specified in the connection string?**
Code listing follows:
________________________________________________
OpenExchange_Folder()
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 - Vaughan Davies|Projects;" _
& "Profile=MS Exchange Settings;" _
& "TABLETYPE=0;DATABASE=C:\WINDOWS\TEMP;"
.Open
End With
With ADORS
.Open "Select * from Minutes", ADOConn, daOpenStatic, adLockReadOnly
.MoveFirst
Debug.Print ADORS(0).Name, ADORS(0).Value
Debug.Print ADORS(1).Name, ADORS(1).Value
Debug.Print ADORS(2).Name, ADORS(2).Value
Debug.Print ADORS(3).Name, ADORS(3).Value
Debug.Print ADORS(4).Name, ADORS(4).Value
Debug.Print ADORS(5).Name, ADORS(5).Value
Debug.Print ADORS(6).Name, ADORS(6).Value
Debug.Print ADORS(7).Name, ADORS(7).Value
Debug.Print ADORS(8).Name, ADORS(8).Value
Debug.Print ADORS(9).Name, ADORS(9).Value
.Close
End With
Set ADORS = Nothing
ADOConn.Close
Set ADOConn = Nothing
End Sub
my own (listed below) to pull data from an Outlook folder into Access. I
don't really know what I'm doing though, and I'm struggling to find the ADO
connection string syntax to vary the code to fit what I want.
This code does pull in the specified data, but I want to access data in
other folders; e.g.: 'Mailbox - Vaughan Davies\Projects\Financials' or in a
public folder. I have tried:
"MAPILEVEL=Mailbox - Vaughan Davies|Projects|Financials;"
"MAPILEVEL=Mailbox - Vaughan Davies|Projects\Financials;"
"MAPILEVEL=Mailbox - Vaughan Davies\Projects\Financials;"
"MAPILEVEL=Mailbox - Vaughan Davies/Projects/Financials;"
... and every combination of "/", "|" & "\" but can't make it work.
** Can anyone point me to a reference on ADO connection string syntax that
might cover this aspect. **
** Also, the data returned seems to be that shown in the currrent view of
the folder. Can another view be specified in the connection string?**
Code listing follows:
________________________________________________
OpenExchange_Folder()
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 - Vaughan Davies|Projects;" _
& "Profile=MS Exchange Settings;" _
& "TABLETYPE=0;DATABASE=C:\WINDOWS\TEMP;"
.Open
End With
With ADORS
.Open "Select * from Minutes", ADOConn, daOpenStatic, adLockReadOnly
.MoveFirst
Debug.Print ADORS(0).Name, ADORS(0).Value
Debug.Print ADORS(1).Name, ADORS(1).Value
Debug.Print ADORS(2).Name, ADORS(2).Value
Debug.Print ADORS(3).Name, ADORS(3).Value
Debug.Print ADORS(4).Name, ADORS(4).Value
Debug.Print ADORS(5).Name, ADORS(5).Value
Debug.Print ADORS(6).Name, ADORS(6).Value
Debug.Print ADORS(7).Name, ADORS(7).Value
Debug.Print ADORS(8).Name, ADORS(8).Value
Debug.Print ADORS(9).Name, ADORS(9).Value
.Close
End With
Set ADORS = Nothing
ADOConn.Close
Set ADOConn = Nothing
End Sub