How to add custom internet headers to emails?

若如初见. 提交于 2020-01-06 02:25:33

问题


Can someone provide how to create and add custom internet headers to the mailItem and how to read them later? I am trying to attach a keyword to every email that is sent so it can be read by another outlook client with the same add-in.


回答1:


Assuming you're writing a Outlook Plugin (based on your tag). Get a Handle on your current mail item (email in draft form)...

// 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);

You might get away something like this:

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

// Reads Your Custom Header
string valueResult = CurrentMailItem.PropertyAccessor.GetProperty("CustomHeaderName");

Also, check out: https://social.msdn.microsoft.com/Forums/office/en-US/b4218b03-d495-459f-a112-8d4e1e05ad3e/set-custom-headers-to-outlook-mailitem?forum=outlookdev



来源:https://stackoverflow.com/questions/36133383/how-to-add-custom-internet-headers-to-emails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!