detecting that email is reply

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

detecting that email is reply
 
Ivan Petrovic




Posts: 11
Joined: 2011-11-15
Hello,

Is there a way to detect that email (in Item) is "reply e-mail"? in event OnItemSend on OutlookAppEvents comoponent.

TAddInModule.adxOutlookAppEvents1ItemSend(ASender: TObject;
const Item: IDispatch; var Cancel: WordBool);

We are detecting some text in Item.htmlbody but we need to ignore this detect if the e-mail is reply.

Thanks in advance,

Ivan Petrovic
Posted 25 Mar, 2012 10:19:44 Top
Andrei Smolin


Add-in Express team


Posts: 19138
Joined: 2006-05-11
Hello Ivan,

You can intercept all possible ways to create a reply and then mark the reply with a UserProperty. Then in the ItemSend event, you will need to delete that property. "All possible ways" are buttons (CommandBar and ribbon) and keyboard shortcut. Find a non-Delphi way to this in these articles:

- http://www.add-in-express.com/creating-addins-blog/2011/12/08/handle-outlook-item-reply-event/
- http://www.add-in-express.com/creating-addins-blog/2011/12/13/outlook-item-reply-inspector-activate/
- http://www.add-in-express.com/creating-addins-blog/2011/12/14/outlook-reply-event-context-menu/

There's an unfixed flaw in my handling context menu in the last blog. In case of Outlook 2010, you need to intercept the Ribbon command IdMso="Reply" and handle it in this way (sorry, it's C#)

private void ribbonCommandReply_OnAction(object sender, IRibbonControl control, bool pressed, ADXCancelEventArgs e)
{
    Debug.Print("The Reply button is clicked.");
    object context = control.Context;
    if (context is Outlook.Selection)
    {
        Outlook.Selection selection = control.Context as Outlook.Selection;
        ConnectToSelectedItem(selection);
    }
    Marshal.ReleaseComObject(context);
}



Andrei Smolin
Add-in Express Team Leader
Posted 26 Mar, 2012 02:47:28 Top