VSTO Outlook 集成 - 用于同步的 Outlook 关闭事件
我正在开发一个 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 afterQuit
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Explorer.Close() 和 Inspector.Close() 在 Application.Quit() 之前触发 - 在其中您可以检查:
如果是这样,Outlook 将关闭,您可以触发事件。请记住,如果您遇到问题,Outlook 也可以无窗口启动(自动化等)。
Explorer.Close() and Inspector.Close() fire before Application.Quit() - in them you can check:
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.