我正在尝试使用 Microsoft.Exchange.WebServices.dll (EWS APIs) 在 Office 365 上保存电子邮件
EmailMessage f_ObjEWSMail = new EmailMessage(objExchangeService);
f_ObjEWSMail.Save(p_objFoderID); // Throwing error here
它随机抛出异常:
无法从传输连接读取数据:现有连接被远程主机强行关闭。
在 System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult)
在 System.Net.TlsStream.EndRead(IAsyncResult asyncResult)
在 System.Net.PooledStream.EndRead(IAsyncResult asyncResult)
在 System.Net.Connection.ReadCallback(IAsyncResult asyncResult)
或者有时它会抛出:
请求失败。底层连接已关闭:接收时发生意外错误。
Stack Strace :: at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest
1.Execute() at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalCreateItems(IEnumerable
1 个项目,FolderId parentFolderId, Nullable1 messageDisposition, Nullable
1 sendInvitationsMode, ServiceErrorHandling errorHandling) 在 Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable1 messageDisposition, Nullable
1 sendInvitationsMode) 在 Microsoft.Exchange.WebServices.Data.Item.Save(FolderId parentFolderId) 在 Office365EWSWriter.Office365Engine。 SaveMail(EmailMessage p_objEWSMailItem, FolderId p_objFoderID)
请提出解决方案。