Intercept reply/reply all/forward event fired by explorer compose mode

Add-in Express™ Support Service
That's what is more important than anything else

Intercept reply/reply all/forward event fired by explorer compose mode
 
wehbi




Posts: 76
Joined: 2013-10-31
I'm searching for a way to intercept the reply and forward event which is fired by the explorer window compose mode. The OutlookItemEventsClass is working when the mail is undocked, but not when I edit the mail within the explorer window.
Is there a way to fulfill the need?

Thanks and regards,
Birger
Posted 02 Jul, 2019 02:14:50 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hello Birger,

OutlookItemEventsClass allows getting events of an Outlook *item*, not Explorer.

In Explorer, there is only one item that can be replied/repliedAll/forwarded. This is the item currently selected. In other words, you call Explorer.Selection (be aware, calling this property may produce an exception), make sure the returned value (of the Outlook.Selection type) is not null, that Selection.Count is 1 (strictly) and connect to the events of that item.

Another way to reply an email from Explorer is to right-click it and choose Reply/ReplyAll/Forward on the context menu. To connect to events of such an item, add an invisible Ribbon button to the corresponding Ribbon menu and handle the PropertyChanging event of that button. In the event handler, you check that e.PropertyType is Visible; in this case, you get e.Context, make sure that the context object is of the Outlook.Selection type, that Selection.Count is 1 (strictly) and connect to the events of that item.

The question is: when to disconnect from events? You should check our free Outlook Events Logger add-in; see https://www.add-in-express.com/creating-addins-blog/2010/07/01/outlook-events-tool/. I expect that after the context menu closes, you get an ExplorerActivate event; in this case, you need to disconnect from events of the currently connected item and connect to events of the item selected in *this* Explorer.


Andrei Smolin
Add-in Express Team Leader
Posted 02 Jul, 2019 05:00:22 Top