EWS尝试发送邮件时出错

时间:2018-02-20 05:09:02

标签: exchangewebservices

Microsoft.Exchange.WebServices.Data.ServiceResponseException: The request failed schema validation: The 'http://schemas.microsoft.com/exchange/services/2006/types:EmailAddress' element is invalid - The value '' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:NonEmptyStringType' - The actual length is less than the MinLength value.
   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)
   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 items, FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode, ServiceErrorHandling errorHandling)
   at Microsoft.Exchange.WebServices.Data.Item.InternalCreate(FolderId parentFolderId, Nullable`1 messageDisposition, Nullable`1 sendInvitationsMode)
   at Microsoft.Exchange.WebServices.Data.Item.Save(FolderId parentFolderId)
   at EWS_Mail_Object_New.New_Mail1(String UserName, String Password, String MailID, String Service_URL, String recipient, String Subject, String message_body, String cc, Boolean SaveAsDraft, DataTable Attachments, DataTable Inline_Attachments, String bcc, Boolean& Success, String& Message)

1 个答案:

答案 0 :(得分:0)

我刚刚在错误消息中按此行,因为您还没有发布您的代码:

  

EWS_Mail_Object_New.New_Mail1(String UserName,String Password,String MailID,String Service_URL,String recipient,String Subject,   String message_body,String cc,Boolean SaveAsDraft,DataTable   附件,DataTable Inline_Attachments,String bcc,Boolean&   成功,弦乐&消息)

错误表示未设置电子邮件地址.E它是一个空字符串。 调试并检查recipientccbcc是否设置了电子邮件地址。