sternaphile
Programmer
We recently upgraded to Exchange Server 2003. Some time after that, there was a need to create some new user-defined fields to a couple of the Exchange folders. This was done from the Outlook interface. Now, we have a legacy Access app that connects to Exchange via MAPI and retrieves some contact info into an Access mdb. The problem is that these new fields, though they are visibler thru Outlook, are not present from the MAPI connection. How do we make these visible to the Access side from Exchange?
I have included a snippet of code to show you how we are retrieving the Exchange data thru Access.
.
.
.
Dim colItems As Items
Dim tblContacts As Recordset
Dim objItem As Outlook.ContactItem
Dim strMessage As String
Dim strSQL As String
On Error GoTo ERR_ExportContactsFolder
DoCmd.Hourglass True
' This part will do the primary contacts
strSQL = "DELETE Contacts.* FROM Contacts;"
DoCmd.RunSQL strSQL
Set tblContacts = CurrentDb.OpenRecordset("Contacts")
Set colItems = objapp.GetNamespace("MAPI").Folders.Item("Public Folders"). _
Folders.Item("All Public Folders"). _
Folders.Item("FHLBC"). _
Folders.Item("Bank Contact Information"). _
Folders.Item("Contact Management").Items
Set objItem = colItems.GetFirst
Do While Not objItem Is Nothing
tblContacts.AddNew
With objItem
' Get existing field
tblContacts![Customer Number] = .UserProperties("CustomerNo")
' Get existing field
tblContacts!Company = .CompanyName
.
.
.
' Get new field - this fails
tblContacts!ContactUID = .ContactUID
' Get new field - this fails
tblContacts!MPFContact = .MPFContact
.
.
. tblContacts.Update
End With
Set objItem = colItems.GetNext
DoEvents
.
.
.
Any help/advice would be greatly appreciated.
I have included a snippet of code to show you how we are retrieving the Exchange data thru Access.
.
.
.
Dim colItems As Items
Dim tblContacts As Recordset
Dim objItem As Outlook.ContactItem
Dim strMessage As String
Dim strSQL As String
On Error GoTo ERR_ExportContactsFolder
DoCmd.Hourglass True
' This part will do the primary contacts
strSQL = "DELETE Contacts.* FROM Contacts;"
DoCmd.RunSQL strSQL
Set tblContacts = CurrentDb.OpenRecordset("Contacts")
Set colItems = objapp.GetNamespace("MAPI").Folders.Item("Public Folders"). _
Folders.Item("All Public Folders"). _
Folders.Item("FHLBC"). _
Folders.Item("Bank Contact Information"). _
Folders.Item("Contact Management").Items
Set objItem = colItems.GetFirst
Do While Not objItem Is Nothing
tblContacts.AddNew
With objItem
' Get existing field
tblContacts![Customer Number] = .UserProperties("CustomerNo")
' Get existing field
tblContacts!Company = .CompanyName
.
.
.
' Get new field - this fails
tblContacts!ContactUID = .ContactUID
' Get new field - this fails
tblContacts!MPFContact = .MPFContact
.
.
. tblContacts.Update
End With
Set objItem = colItems.GetNext
DoEvents
.
.
.
Any help/advice would be greatly appreciated.