Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - Using Contacts (http://www.outlookbanter.com/outlook-using-contacts/)
-   -   Link Access Table to Exchange Public Folder Contacts (http://www.outlookbanter.com/outlook-using-contacts/3252-link-access-table-exchange-public.html)

Brian January 29th 06 08:05 PM

Link Access Table to Exchange Public Folder Contacts
 
Greetings all! And thanks for s-o-o many fine solutions over the years.
Unfortunately, with hours of searching, I can't achieve success.

Background: Access 2003 & Outlook 2003 Pro SP2, running XP Pro
The Outlook contacts reside on a third-party-hosted Exchange server.

I am seeking a customer solution that will enable an Access DB to link
dynamically to a contacts folder named "TeetersCustomerContacts
in 'Public Folders' under 'All Public Folders' under a 'TPI" folder'.

eg: Public Folders| All Public Folders/TPI/TeetersCompanyContacts

The following code connects (or at least does not break).

QUESTIONS:

1) How do I populate a recordset using 'TeetersCompanyContacts'?

2) How do I create a table (ideally a temp table?) of this data?

Thank you so much for any assistance.

Brian M
-------------------------
Sub OpenExchange_CompanyContacts()
Dim ADOConn As ADODB.Connection
Dim ADORS As ADODB.Recordset
Dim strConn As String

'====== Using as test code only to confirm the nested folder names are
correct
Dim ns As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim myOutlook As Outlook.Application
Set myOutlook = New Outlook.Application
Set ns = myOutlook.GetNamespace("MAPI")
For Each fld In ns.Folders("Public Folders").Folders("All Public
Folders").Folders("TPI").Folders("TeetersCompanyCo ntacts").Folders
Debug.Print fld.Name
Next
'myOutlook.Quit
'Set myOutlook = Nothing
'====== End test of folder names

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\TPI\TeetersCompanyContacts;PROFILE=Test;TA BLETYPE=0;DATABASE=C:\TEMP\"
_
& "PROFILE=MS Exchange Settings;" _
& "TABLETYPE=0;DATABASE=C:\WINDOWS\TEMP\;"
.Open
End With
' With ADORS

' .Open "Select * from TeetersCompanyContacts;", 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




All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com