VSTO Outlook集成 - 展望关闭事件同步 [英] VSTO Outlook integration - Outlook shutdown event for synchronization
问题描述
我工作的一个VSTO Outlook 2007的加载项,基本符合Web服务同步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.
不过,我有问题,找到一个合适的触发事件,来处理我的同步关机。我试着挂钩以下两个事件,但他们似乎都被炒得晚了,当外接程序无法访问Outlook数据,这是行不通的:
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)应用程序).Quit
(这个火灾第一,但它已经太晚了访问Outlook数据收集和更新它们) -
ThisAddIn.Shutdown
(在这一次火灾退出
,所以它不是一样好)
((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)
是否有这些那些的展望关机,我可以用之前被解雇的任何其他活动?或者,也许有人知道任何其他方式来处理同步,在关机的Outlook加载?
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?
推荐答案
Explorer.Close()和Inspector.Close()火Application.Quit()之前 - 在其中您可以查看:
Explorer.Close() and Inspector.Close() fire before Application.Quit() - in them you can check:
- 在Explorer.Close():Application.Explorers.Count< = 1和Application.Inspectors.Count == 0
- 在Inspector.Close():Application.Explorers.Count == 0和Application.Inspectors.Count< = 1
如果这样,Outlook将关闭,你可以解雇你的事件。只要记住,可以将Outlook启动窗口过少(自动化等),如果那是你的问题。
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.
这篇关于VSTO Outlook集成 - 展望关闭事件同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!