我试图删除EmailMessage中附加的Outlook-Mail-Item中的FileAttachment,但它在更新EmailMessage时说以下错误:
至少有一个附件无法删除。
下面是使用的代码:
// eMessageToWork is an attached EmailMessage
// Im saving the attachments from eMessageToWork to disk before i want to remove it from the attached email
Attachment att = eMessageToWork.Attachments[i];
// ... saving attachments to disk ...
// Now remove the attachment from the attached mail
eMessageToWork.Attachments.Remove(att);
// rootMailMessage is the root mail and contains as attachment eMessageToWork
// Here is the problem and the exception is thrown.
rootMailMessage.Update(ConflictResolutionMode.AlwaysOverwrite);
自从版本更改为2016以来,我有更多奇怪的错误需要解决。我甚至无法通过打开outlook手动执行此操作,因为右键单击文件附件时的上下文选项“删除”显示为灰色。
我的访问权限有问题吗?如果是,接下来的问题是,为什么我没有得到正确的异常消息呢? :d
有没有人对Exchange Server 2016的主要安全性变化有所了解,这可能是其来源?
我试过运行你的代码,它在我的电脑上工作正常。
所以我建议你检查的第一件事是用户的权限。
其次,如果这不能解决您的问题,我建议您在代码中添加一个跟踪侦听器并发布您的EWS请求和响应,以便我们可以进一步跟踪它。
这篇文章应该可以帮助您跟踪跟踪器:
How to: Trace requests and responses to troubleshoot EWS Managed API applications