Ready event in Microsoft Outlook 2010?

2019-08-31 11:14发布

问题:

Is there an event in Microsoft Outlook 2010 which one can subscribe on, in order to known when Outlook has finished initializing and all components, folders etc. have been loaded?

回答1:

Not sure about VSTO but good ol' COM addins get the StartupComplete "event" (via IDTExtensibility2) for exactly that purpose.



回答2:

Ok, I found out what I needed to do...

...

private void ThisAddInStartup(object sender, EventArgs e)
{

    this.Application.Startup += ApplicationStartup;
    this.Application.ItemLoad += ApplicationItemLoad;

 }

 void ApplicationItemLoad(object Item)
 {
     //Do something   
 }

 private void ApplicationStartup()
 {
     //Do something
 }

...

http://msdn.microsoft.com/en-us/library/ff869298.aspx



回答3:

Not that I'm aware of. Usually, addins don't do anything that requires talking with many outlook objects till some triggering event happens (like opening a mail, or creating a new inspector) so THAT'S when you'd typically see some custom code hooked in.

In my addins, the code connected to startup does things like load up some config, and maybe connect to a DB (although even that I tend to do on demand vs once at startup).