EWS托管API-删除附件中的附件

时间:2018-09-18 12:58:14

标签: c# exchangewebservices attachment ews-managed-api

im试图删除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的重大安全更改有所了解,这可能就是原因?

1 个答案:

答案 0 :(得分:0)

我尝试运行您的代码,它在我的PC上运行正常。

因此,我建议您检查的第一件事是用户的权限。

第二,如果那不能为您解决问题,我建议向您的代码添加跟踪侦听器,并发布您的EWS请求和响应,以便我们进一步进行跟踪。

这是一篇应该帮助您使用跟踪侦听器的文章:

How to: Trace requests and responses to troubleshoot EWS Managed API applications

相关问题