Home > Net >  Accessing Outlook journal entries from C#
Accessing Outlook journal entries from C#

Time:08-26

For the last 7 years I've been using the Journal entries feature of Outlook to generate daily engineering log entries detailing what I've been working on day-to-day. It looks like MS are 'retiring' the Journal feature in the near future and I'd like to retain my 1000 log entries.

Ideally I would like to export all the Journal entries into a SQLite database and use it as the basis of a new engineering log tool.

Reviewing the available MSDN documentation I was only able to find scant details on programmatically accessing Outlook data. I did identify a number of pay for/open source NuGet packages for accessing Outlook data, but none of them seemed to cover Journal entries.

Has anyone recommend a NuGet package/GitHub project which would handle this, or even a code snippet highlighting accessing Outlook Journal entries ?

CodePudding user response:

JournalItem object can be accessed using Outlook Object Model just fine. Open the default Journal folder using Application.Session.GetDefaultFolder(olFolderJournal), loop through all items in that folder (cast them to JournalItem).

CodePudding user response:

You can use the GetDefaultFolder method to get the Journal folder which contains corresponding items. Just pass the olFolderJournal value. For example, the following VBA macro which can be run on Outlook shows how to get the Journal folder:

Public Sub OpenJournalEntry()
  Dim JournalFolder As Folder
  Dim Item As Object
  Set JournalFolder = Session.GetDefaultFolder(olFolderJournal)
  Set Items = JournalFolder.Items
  Set Item = Items.Item(1)
  Item.Display
End Sub
  • Related