VSTO Outlook 集成 - 用于同步的 Outlook 关闭事件

发布于 2024-08-04 13:30:20 字数 486 浏览 5 评论 0原文

我正在开发一个 VSTO Outlook 2007 加载项,该加载项基本上将 Outlook 数据与 Web 服务同步。我希望在应用程序中实现三种类型的同步:启动同步、手动同步和关机同步。前两个很简单并且已经完成了。

但是,我无法找到合适的事件来触发以处理关闭时的同步。我尝试挂钩以下两个事件,但当加载项无法访问 Outlook 数据时,它们似乎被触发得太晚了,这不起作用:

  • ((Outlook.ApplicationEvents_Event)Application).Quit (这个首先触发,但现在访问 Outlook 数据集合并更新它们已经太晚了)
  • ThisAddIn.Shutdown (这个在 Quit 之后触发,所以它不是也很好)

是否有其他事件在我可以使用的 Outlook 关闭事件之前触发?或者也许有人知道在 Outlook 加载项中处理关闭时同步的任何其他方法?

I'm working on a VSTO Outlook 2007 add-in that basically synchronizes Outlook data with web service. There are three types of synchronization that I want to have in the app: startup sync, manual sync and sync on shutdown. The first two as simple and are already done.

However I have problems finding an appropriate event to fire to handle my sync on shutdown. I tried hooking to the following two events but it seems that they are fired too late when add-in doesn't have access to Outlook data and this just doesn't work:

  • ((Outlook.ApplicationEvents_Event)Application).Quit (this one fires first, but it's already too late to access Outlook data collections and update them)
  • ThisAddIn.Shutdown (this one fires after Quit so it's not good as well)

Are there any other events that are fired before those ones on Outlook shutdown that I could use? Or maybe someone knows any other way to handle sync-on-shutdown in Outlook add-in?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伴梦长久 2024-08-11 13:30:20

Explorer.Close() 和 Inspector.Close() 在 Application.Quit() 之前触发 - 在其中您可以检查:

  • In Explorer.Close(): Application.Explorers.Count<=1 和 Application.Inspectors.Count==0
  • In Inspector.Close():Application.Explorers.Count==0 且 Application.Inspectors.Count<=1

如果是这样,Outlook 将关闭,您可以触发事件。请记住,如果您遇到问题,Outlook 也可以无窗口启动(自动化等)。

Explorer.Close() and Inspector.Close() fire before Application.Quit() - in them you can check:

  • In Explorer.Close(): Application.Explorers.Count<=1 and Application.Inspectors.Count==0
  • In Inspector.Close(): Application.Explorers.Count==0 and Application.Inspectors.Count<=1

If so, Outlook will close and you can fire your events. Just keep in mind that Outlook can be started window-less too (automation etc.) if thats an issue for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文