Getting Exception connecting to Office 365

Hi,

I am using following code to connect to our Office 365 account but getting failed. Please help.

ExchangeClient client = new ExchangeClient(“https:[//outlook.office365.com/ews/exchange.asmx](https://outlook.office365.com/ews/exchange.asmx)
”,“Username”, “password”, “domain”);

Hi Michael,

Thank you for contacting Aspose Support team.

You should use the IEWSClient rather than the ExcahngeClient to connect to Office365 mailbox. Please try the following code at your end and let us know your feedback.

Sample Code:

const string mailboxUri = “https:[//outlook.office365.com/ews/exchange.asmx](https://outlook.office365.com/ews/exchange.asmx)”;
const string domain = @"";
const string username = @"username@ASE305.onmicrosoft.com";
const string password = @“password”;
NetworkCredential credentials = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);