Search code examples
outlookvstooutlook-addinoffice-addins

VSTO Outlook: Handle event when a new email address has been added to "TO" field in the compose window and then change the email address


In compose window I would like to handle the event that is produced just when the user has entered a new email address (recipient) into the "TO" field. After that I would like to modify the email address by applying it an html format and a style such as below:

<html><body><span style="color:red">[email protected]</span></body></html>

The purpose of it is to make this email address get shown as red.

How can I subscribe to MailItem PropertyChanged event as explained here:

Outlook VSTO recipients changed event

I want to do exactly the same, process the recipients in the "TO" field.

so in case it is possible, how can achieve that? and is Outlook able to parse that html format?


Solution

  • how can achieve that? and is Outlook able to parse that html format?

    It is not possible, the Outlook extensibility model doesn't provide anything for customizing the recipients list (the To or Cc fields). The best what you could do is to replace the inspector view with your own form, see Advanced Outlook view and form regions for possible layouts, but I guess you will be interested in the CompleteReplacement layout. Note, in that case you will have to implement all the required functionality on your own.