(Outlook 2010) 在 C# 中获取邮件标头
我从这里改编了 Ken Slovak 的代码来阅读发送邮件之前,邮件上有 MailItem 标头,但我的标头字符串显示为空。这仅适用于收到的消息吗?如果是这样,在撰写转发/回复/回复全部之前拉入原始邮件的标头的好方法是什么?
这是我重新完成的代码:
Outlook.PropertyAccessor oPA = msg.PropertyAccessor as Outlook.PropertyAccessor;
const string PR_MAIL_HEADER_TAG = @"http://schemas.microsoft.com/mapi/proptag/0x007D001E";
try
{
string strHeaders = (string)oPA.GetProperty(PR_MAIL_HEADER_TAG);
}
catch { }
谢谢
I've adapted Ken Slovak's code from here to read MailItem headers on a message before it is sent, but my header string is coming up as empty. Does this only work on received messages? If so, what would be a good method for pulling in the headers of the original message before composing Forward/Reply/Reply-To-All?
Here is my re-done code:
Outlook.PropertyAccessor oPA = msg.PropertyAccessor as Outlook.PropertyAccessor;
const string PR_MAIL_HEADER_TAG = @"http://schemas.microsoft.com/mapi/proptag/0x007D001E";
try
{
string strHeaders = (string)oPA.GetProperty(PR_MAIL_HEADER_TAG);
}
catch { }
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅当原始消息发送后,才会填充消息标头。我尝试了您的代码,它返回了我收到的邮件的消息标题。不过,当我尝试访问该消息时,确实收到了安全弹出窗口。
The message headers will only be populated once the original message has been sent. I tried your code and it returned the message headers for mail that I had received. I did get the security popup when trying to access the message though.