'Set a custom "forwarded" message to Mail Item via VSTO Outlook 2013 Plugin

I am developing a VSTO Plugin for Outlook 2013 (or higher) that allows users to forward mail contents and sender/recipient data to some other program. The sending of mail data works great, I would however like to mark the mail in Outlook that I forwarded, so that the user can clearly see which mails were forwarded.

I have tried several options, which worked for me, but the end result is not quite what I would like.

For example:

  • I can set a category for the mail with a custom text "Mail forwarded to XY"
  • I can set one of the Outlook Icons as the symbol (PidTagIconIndex)

One option I didn't try yet is creating a custom Form and I would like to avoid that option if possible.

What I would like to do is set something like this (sorry for the german screenshot):

enter image description here

This text appears when I forward a mail to some other recipient in Outlook. Is it possible to set this programatically (with C#) - if possible with custom text?



Solution 1:[1]

You need to set the PR_LAST_VERB_EXECUTED (DASL name http://schemas.microsoft.com/mapi/proptag/0x10810003) and PR_LAST_VERB_EXECUTION_TIME (DASL name http://schemas.microsoft.com/mapi/proptag/0x10820040) using MailItem.PropertyAccessor.SetProperty - take a look at an existing message with OutlookSpy (I am its author - click IMessage button).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1