Outlook 2013 AddIn - Mailitem paste event RRS feed

  • Question

  • Hello,

    the following situation:

    A user paste an xml text into a new mail. Now I want to detect this (maybe with a kind of paste event), get the pasted xml and transform it into another textformat.

    Unfortunately I didn't found a paste event. How can I do this?

    I want to do this within an Outlook 2013 Addin. I started to develop the Addin and can do several things, but have not found how to grab the paste event.

    It would be nice to get some help.



    Thursday, April 10, 2014 1:27 PM

All replies

  • Hello Andreas,

    You are right, the Outlook object model doesn't provide any paste related event. Instead, you can try to handle the PropertyChange event of Outlook items. It is fired when an explicit built-in property (for example, Subject) is changed. Note, sometimes you need to save the item or just move the cursor to another field to get it fired.

    Depending on the message format you can use the following properties for customizing the body:

    1. Body

    2. RTFBody

    3. HTMLBody

    4. WordEditor.

    The Chapter 17: Working with Item Bodies describes all possible ways for working with mail item bodies. To determine what format the message is using, check the value of its BodyFormat property. Message and post items can be in HTML, rich-text (RTF), or plain text format. You can change the format of a message or post by setting its BodyFormat property to a different value. Doing so will lose all formatting if the original message was in HTML or RTF format.

    Thursday, April 10, 2014 1:40 PM