'How to add icons to emails in Outllook?

While Folder.SetCustomIcon can be used to customize folder icons, the only thing related to icons for messages seems to be the deprecated (and basically undocumented) mailitem.FlagIcon. Is there any way to have a custom icon shown next to emails in the message view, e.g. via a custom column? As an example, the gravatar (or identicon) associated with a sender's email-address might be shown left of the "From" column.



Solution 1:[1]

MailItem.FlagIcon is very much documented - https://msdn.microsoft.com/en-us/library/office/aa211991(v=office.11).aspx - but is does not really apply in your case.

Outlook can show an icon in a few cases:

  1. Set the PR_ICON_INDEX MAPI property (take a look at a message with OutlookSpy (I am its author) - select a message, click the IMessage button, find the PR_ICON_INDEX property, double click to edit). You can set a couple dozen or so predetermined icons, that is how Outlook sets the replied/forwarded/etc. icons.

  2. If you design a custom form, you can associate it with a custom icon. Outlook will show the icon based on the message class (MessageClass in OOM or PR_MESSAGE_CLASS in Extended MAPI). You can see PR_MESSAGE_CLASS in OotlookSpy (click IMessage) and the custom form data (click IMAPIFormMgr).

One thing you cannot do is show a custom icon programmatically based on an one-off icon set on the item itself.

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