简体   繁体   English

从 C# 访问 Outlook 日记帐分录

[英]Accessing Outlook journal entries from C#

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.在过去的 7 年里,我一直在使用 Outlook 的日志条目功能来生成每日工程日志条目,详细说明我每天的工作。 It looks like MS are 'retiring' the Journal feature in the near future and I'd like to retain my 1000+ log entries.看起来 MS 在不久的将来会“淘汰”日记功能,我想保留我的 1000 多个日志条目。

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.理想情况下,我想将所有日志条目导出到 SQLite 数据库中,并将其用作新工程日志工具的基础。

Reviewing the available MSDN documentation I was only able to find scant details on programmatically accessing Outlook data.查看可用的 MSDN 文档,我只能找到有关以编程方式访问 Outlook 数据的少量详细信息。 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.我确实确定了一些付费/开源 NuGet 包用于访问 Outlook 数据,但它们似乎都没有涵盖日记条目。

Has anyone recommend a NuGet package/GitHub project which would handle this, or even a code snippet highlighting accessing Outlook Journal entries?有没有人推荐一个可以处理这个问题的 NuGet 包/GitHub 项目,或者甚至是突出显示访问 Outlook 日志条目的代码片段?

JournalItem object can be accessed using Outlook Object Model just fine. JournalItem object 可以使用 Outlook Object ZA559B87068921EEC05086CE548 访问。 Open the default Journal folder using Application.Session.GetDefaultFolder(olFolderJournal) , loop through all items in that folder (cast them to JournalItem ).使用Application.Session.GetDefaultFolder(olFolderJournal)打开默认的 Journal 文件夹,遍历该文件夹中的所有项目(将它们投射到JournalItem )。

You can use the GetDefaultFolder method to get the Journal folder which contains corresponding items.您可以使用GetDefaultFolder方法获取包含相应项目的Journal文件夹。 Just pass the olFolderJournal value.只需传递olFolderJournal值。 For example, the following VBA macro which can be run on Outlook shows how to get the Journal folder:例如,可以在 Outlook 上运行的以下 VBA 宏显示了如何获取 Journal 文件夹:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM