missing data in exported outlook journal

D

davidchadwick

I am trying to generate a detailed report of all journal entries for a given
day by exporting the journal as an Access file and then making a report from
a query that selects the date; however, Outlook 2003 is not exporting the
contact data. In the Access table, the columns are there for contact name,
&c, but the cells are all blank. How can I convince Outlook 2003 to export
this data? Or is there another path to the goal of a detailed report of all
journal entries for a given day?
 
S

Sue Mosher [MVP-Outlook]

The "contact data" for each item is actually the JournalItem.Links
collection and can't export as a simple text field. You'd need to write code
to extract the data directly from the JournalItem objects.
 
D

davidchadwick

Thanks so much for your response Sue. As a result I had your book overnighted
to me and I've spent the last two weeks pouring over it, looking for clues as
to how to extract a contact name from a JournalItem object. Here's what I've
come up with (code is run 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

I'm getting the same results (i.e. a full table except for the contact
name), and I'm more confused than ever. I am assuming that there is some
essential concept that I am not grasping, but then again I could be on the
right track for all I know. Any enlightenment from anyone would be a huge
help.

Thanks,
David Chadwick
 
D

davidchadwick

Thanks so much for your response Sue. As a result I had your book overnighted
to me and I've spent the last two weeks pouring over it, searching for clues
on how to extract a contact name from a JournalItem object. Here's what I've
come up with (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

The results are a nearly-full table - the contact name data is still
missing. I am assuming that there is some essential concept that I am still
not grasping, but then again I could be on the right track, for all I know.
Any enlightenment anyone can provide would be extremely helpful.

Thanks,
David Chadwick
 
D

davidchadwick

Thanks so much for your response Sue. As a result I had your book overnighted
to me and I've spent the last two weeks pouring over it, searching for clues
on how to extract a contact name from a JournalItem object. Here's what I've
come up with (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

The results are a nearly-full table - the contact name data is still
missing. I am assuming that there is some essential concept that I am still
not grasping, but then again I could be on the right track, for all I know.
Any enlightenment anyone can provide would be extremely helpful.

Thanks,
David Chadwick
 
D

davidchadwick

Thanks so much for your response Sue. As a result I had your book overnighted
to me and I've spent the last two weeks pouring over it, searching for clues
on how to extract a contact name from a JournalItem object. Here's what I've
come up with (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

The results are a nearly-full table - the contact name data is still
missing. I am assuming that there is some essential concept that I am still
not grasping, but then again I could be on the right track, for all I know.
Any enlightenment anyone can provide would be extremely helpful.

Thanks,
David Chadwick
 
Top