After a few hrs of experimentation and google searches I have finally come to the end of what I can figure out on my own, so here is what I have now:
private void ThisAddIn_Startup(object sender, System.EventArgs e) { Application.Startup += new Outlook.ApplicationEvents_11_StartupEventHandler( ApplicationObject_Startup); ((Outlook.ApplicationEvents_11_Event)Application).Quit += new Outlook.ApplicationEvents_11_QuitEventHandler( ApplicationObject_Quit); } void ApplicationObject_Startup() { MessageBox.Show("Startup Event"); ((Outlook.ExplorerEvents_10_Event)Application.ActiveExplorer()).Close += new Outlook.ExplorerEvents_10_CloseEventHandler( ExplorerObject_Close); } void ApplicationObject_Quit() { MessageBox.Show("Quit Event"); } void ExplorerObject_Close() { MessageBox.Show("Explorer Close Event"); } All of this works, and when I close outlook I see the explorer close event and quit event message boxes in order. However by this point outlook seems to already have closed, and I have no idea how to cancel these events (for some other events there is a bool Cancel passed in that you can set to false, but not for these events?), or send a minimize event (I haven't been able how to figure this out at all).
If anyone has any suggestions I'd really appreciate it. I had some spare time at work and figured I'd try to learn some addin dev stuff, and solve a really annoying part of outlook at the same time!
EDIT: I have also tried:
Application.ActiveExplorer().WindowState = Outlook.OlWindowState.olMinimized; at startup to just immediately minimize the window. It does minimize outlook, but not to the systen tray, only onto the bar (which is funny, and probably actually a bug, since minimize is set to minimize to tray...) Still, if I could just get rid of the close/quit event(s) I could at least just minimize the window to the taskbar.