We recently updated our Aspose.Email.dll to version 126.96.36.199 in order to accommodate Exchange 2013.
If connecting to an Exchange 2013 instance, we have no issues. If we connect to previous versions of Exchange, we are getting this error, as if we need to set the Exchange version. I am willing to do this in my code, I just don’t see any examples of doing this.
Here is our code:
private static IEWSClient CreateEWSConnection()
clsEncryptor ende = new clsEncryptor();
TblCtSystemValues objMailSettings = new TblCtSystemValues();
string _hostname = objMailSettings.MailHostName;
if (_hostname.EndsWith("/") || _hostname.EndsWith("\"))
_hostname = _hostname.Remove(_hostname.Length - 1);
DataRow dr = TblCtUserProfile.GetADUserEmailInfo(clsSession.UserID).Rows;
string _emailUserId = dr[“ADUserName”].ToString();
string _domain = dr[“ADDomain”].ToString();
string _password = ende.DecodeDecrypt(dr[“ADPassword”].ToString());
return CreateEWSConnection(_emailUserId, _password, _domain, _hostname);
private static IEWSClient CreateEWSConnection(string UserId, string Password, string Domain, string ExchangeServer)
string _hostname = ExchangeServer;
string _emailUserId = UserId;
string _domain = Domain;
string _password = Password;
NetworkCredential credentials = new NetworkCredential(UserId, Password, Domain);
IEWSClient client = EWSClient.GetEWSClient(ExchangeServer, credentials);
The error is thrown on the highlighted line. Is this because it is assuming a specific version of Exchange?