2021年1月22日星期五

Outlook VSTO - How to identify when Outlook is fully loaded

I have a Outlook VSTO written in C#. I am using Outlook 2016 (Office 365).

I am attempting to ascertain the moment when Outlook has fully loaded and updated all stores and if possible fire an event when that occurs, so I can enable / disable certain buttons in the ribbon.

My question here is how do I know when Outlook has fully instantiated and finished loading all stores on the initial startup?

The closest I have been able to ascertain is when the last Application.Reminder event is fired, but there must be a simpler way. The Application.Reminder event is fired each time a reminder is loaded into the reminder window, which is only shown on the initial start up of Outlook once all of the stores are updated, and it is about then I wish to fire a custom event.

A similar question is asked here with no real answer.

MTIA

Darrin

Edit 1: I have ascertained that the event I am looking for can be captured using the Application.Reminders.BeforeReminderShow event - this event fires just prior to the Reminder Window being shown.

The event can be hooked up in the Application Startup event ..

Application.Reminders.BeforeReminderShow += Reminders_BeforeReminderShow;    private void Reminders_BeforeReminderShow(ref bool Cancel)  {      Debug.WriteLine("Reminders_BeforeReminderShow");      MessageBox.Show("Reminders_BeforeReminderShow");  }  

However, it also seems that this event does not fire if another VSTO has hooked the event perhaps creating a race condition ... if the other VSTO is unloaded - the event fires normally ...

https://stackoverflow.com/questions/65854118/outlook-vsto-how-to-identify-when-outlook-is-fully-loaded January 23, 2021 at 07:28AM

没有评论:

发表评论