exporting JournalItem object ContactNames property data

G

Guest

I am trying to extract data from JournalItem objects and import the data into
Access. The routine works fine except the ContactNames property data is not
extracted. This leads me to believe that I am somehow extracting the data
from the JournalItem.Links collection, rather than from the actual
JournalItem objects, but I haven’t been coding long enough to know for sure.
If anyone out there knows what I’m doing wrong here, or better yet, can point
me in the right direction to be able to return the JournalItem.ContactNames
data from the JournalItem object, I’d be grateful. Here’s where I am with it
(code runs from Access):

Sub ImportJournalFromOutlook()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblJournal")

Dim objApp As New Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objItem As Outlook.JournalItem
Dim objItems As Outlook.Items

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderJournal)
Set objItems = objFolder.Items
iJournal = objItems.Count

For i = 1 To iJournal
If TypeName(objItems(i)) = "JournalItem" Then
Set objItem = objItems(i)
strStoreID = objItem.Parent.StoreID
strEntryID = objItem.EntryID
Set objItem = objNS.GetItemFromID(strEntryID, strStoreID)
rst.AddNew
rst!EntryID = objItem.EntryID
rst!Subject = objItem.Subject
rst!Company = objItem.Companies
rst!StartTime = objItem.Start
rst!Contacts = objItem.ContactNames
rst!Categories = objItem.Categories
rst!Body = objItem.Body
rst.Update
End If
Next i
rst.Close
MsgBox "journal entries imported."
End Sub

Again, any enlightenment anyone can provide would be extremely helpful.

Thanks,
David Chadwick
 

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