Connecting to the replyAllEvent

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

Connecting to the replyAllEvent
 
Jimmy Kavanagh




Posts: 10
Joined: 2010-04-27
I have watched you videos and have seen an example of how to connect to the ProcessItemAdd event of a folder. How can I connect to the the event that fires when a user hits "Reply To All" on a message?

I have added an OutlookItemsEventsClass to my project and I initalise it in the AddinModule_AddinStartupComplete event. But I am not sure what to use for the ConnectTo method:

m_ItemEvents = New OutlookItemEventsClass1(Me)
m_ItemEvents.ConnectTo(...)
Posted 27 Apr, 2010 05:11:32 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hi Jimmy,

You need to use the Outlook Item (not Items!) Events item in the Add Item dialog. When connecting, you pass an Outlook item to that class. In the class, you handle the ProcessReplyAll method.


Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2010 05:33:56 Top
Jimmy Kavanagh




Posts: 10
Joined: 2010-04-27
Privet Andrei!

I am indeed using "Outlook Item" events - there is a simple ProcessReplyAll stub in my project which was generated by your wizard.

What I need to know is how to connect the event handler up to something. Do i have to monitor all opened mail inpectors and then connect the event handler to each one, or can i just do one ConnectTo when the addin starts so that it will automtically connect to all opened inspectors.

Forgive my stupidity - I am only learning how all this stuff works... Do you have a sample project handy that would show me how to monitor the ReplyAll event for opened messages?
Posted 27 Apr, 2010 07:00:33 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Privet Jimmy,

You need to monitor the ExplorerSelectionChange event of the Outlook Events component (right-click the designer surface of the add-in module to add the component). In the corresponding event handler, you need to connect to the first or all items selected (in this case you need to maintain an array of OutlookItemEvents). Now a scenario: the user selects item #1, right-clicks item #2 and chooses ReplyAll in the context menu. In Outlook 2000-2003, there's no way to handle this scenario. In Outlook 2007 and higher you can add a context menu component and point it to the ItemContextMenu of Outlook; in the event handler, you get Outlook.Selection object, then you connect to its items.

Also, you need to monitor the InspectorActivate event of the Outlook Events component. You need to connect to received items only; they have MailItem.Sent = True.

There's a sample covering some of the things mentioned above, see http://www.add-in-express.com/files/projects_pub/outlookitemevents-vb-2005.zip


Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2010 07:32:26 Top
Jimmy Kavanagh




Posts: 10
Joined: 2010-04-27
Thank you Andrei,

I downloaded the sample and tried to build in in VS2008 but I get the following error:

Error 2 Class 'OutlookItemEventsClass1' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s):
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessAttachmentRemove(attachment As Object)
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessBeforeAttachmentAdd(attachment As Object, e As AddinExpress.MSO.ADXCancelEventArgs)
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessBeforeAttachmentPreview(attachment As Object, e As AddinExpress.MSO.ADXCancelEventArgs)
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessBeforeAttachmentRead(attachment As Object, e As AddinExpress.MSO.ADXCancelEventArgs)
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessBeforeAttachmentWriteToTempFile(attachment As Object, e As AddinExpress.MSO.ADXCancelEventArgs)
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessBeforeAutoSave(e As AddinExpress.MSO.ADXCancelEventArgs)
AddinExpress.MSO.ADXOutlookItemEvents : Public MustOverride Sub ProcessUnload(). C:\temp\explorerchange\outlookitemevents-vb\OutlookItemEventsClass1.vb 5 14 OutlookItemEvents
Posted 27 Apr, 2010 08:33:41 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hi Jimmy,

Add another Outlook Item Events class to that project and copy the required members to OutlookItemEventsClass1.


Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2010 09:14:51 Top