如何向电子邮件添加自定义 Internet 标头?

Kuf*_*fel 4 vsto outlook-addin visual-studio-2015

有人可以提供如何创建自定义 Internet 标题并将其添加到 mailItem 以及以后如何阅读它们吗?我正在尝试在发送的每封电子邮件中附加一个关键字,以便其他具有相同加载项的 Outlook 客户端读取它。

Ste*_*edy 6

假设您正在编写 Outlook 插件(基于您的标签)。获取当前邮件项目的句柄(草稿形式的电子邮件)...

// Describes your Custom Header
string  PS_INTERNET_HEADERS = "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/Custom-Property-Name";

// Sets Your Custom Header
CurrentMailItem.PropertyAccessor.SetProperty(PS_INTERNET_HEADERS, "ValueOfCustomProperty" );

// Reads Your Custom Header
string valueResult = CurrentMailItem.PropertyAccessor.GetProperty(PS_INTERNET_HEADERS);
Run Code Online (Sandbox Code Playgroud)

你可能会逃脱这样的事情:

// Sets Your Custom Header
CurrentMailItem.PropertyAccessor.SetProperty("CustomHeaderName", "ValueOfCustomProperty" );

// Reads Your Custom Header
string valueResult = CurrentMailItem.PropertyAccessor.GetProperty("CustomHeaderName");
Run Code Online (Sandbox Code Playgroud)

另外,请查看:https : //social.msdn.microsoft.com/Forums/office/en-US/b4218b03-d495-459f-a112-8d4e1e05ad3e/set-custom-headers-to-outlook-mailitem?forum=outlookdev