使用EWS API修改EmailMessage的发件人(或发件人地址) [英] Modify Sender (or From address) of EmailMessage using EWS API
问题描述
我正在尝试修改公用文件夹项的发件人(或发件人地址)。虽然Sender和From属性可根据此文档写入:
https://msdn.microsoft.com/en-us/library/office/dn600367 (v = exchg.150).aspx
但是当我尝试修改这些属性时,EWS API会抛出错误。
当我尝试修改电子邮件项目的"发件人"字段时,我收到此错误:
I am trying to modify Sender (or From address) of public folder items. Though Sender and From properties are writable according to this document:
https://msdn.microsoft.com/en-us/library/office/dn600367(v=exchg.150).aspx
but EWS API is throwing error when I am trying to modify these properties.
When I am trying to modify 'From' field of email item, i m getting this error:
Exception: Message is not draft.
< span style ="color:#252523; FONT-FAMILY:黑体,宋体,无衬线;字体大小:13像素; line-height:16.5454540252686px">当我尝试修改电子邮件项目的"发件人"字段时,我收到此错误:
When I am trying to modify 'Sender' field of email item, i m getting this error:
Exception: This property can't be updated.
我还使用邮箱的收件箱文件夹中的电子邮件项进行了测试,并遇到了相同的错误。
< span style ="color:#252523; FONT-FAMILY:黑体,宋体,无衬线;字体大小:13像素; line-height:16.5454540252686px">这是一段代码,我正在使用
foreach (Item item in findResults.Items)
{
EmailMessage msg = item as EmailMessage;
msg.Sender = new EmailAddress("jt@mydomain.onmicrosoft.com");
//Also tried
// msg.From= new EmailAddress("jt@mydomain.onmicrosoft.com");
msg.Update(ConflictResolutionMode.AutoResolve);
}
我希望找到一些替代方法。任何人都可以帮忙。
感谢您的期待。
此致,David Johnson
Regards, David Johnson
推荐答案
这些属性只有在将Item提交到Exchange存储之前才可写(例如,在调用save,sent etc之前)。您可以使用
中列出的扩展属性更改发件人提交后,请访问https://msdn.microsoft.com/en-us/library/hh745482(v=exchg.80).aspx 。
干杯
这篇关于使用EWS API修改EmailMessage的发件人(或发件人地址)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!