Getting exception on IEWSClient statement execution

Hi,

on execution of below statement i am getting exception, Can anybody from Aspose tema suggest what wrong i am doing here. That would be helpful.

// Create instance of EWSClient class by giving credentials
IEWSClient client = EWSClient.GetEWSClient(“https:[//outlook.office365.com/ews/exchange.asmx](https://outlook.office365.com/ews/exchange.asmx)”, "vipinp@xyz.com", “aabc@123”, “xyz”);

Here is the Exception details:

An exception of type ‘System.InvalidOperationException’ occurred in System.Web.Services.dll but was not handled in user code


Additional information: Client found response content type of ‘text/html; charset=utf-8’, but expected ‘text/xml’.


Client found response content type of ‘text/html; charset=utf-8’, but expected ‘text/xml’.

Thanks in advance

Vipin Panwar

Hi Vipin,

Thank you for your inquiry.

We have tested this issue at our end and the latest version of Aspose.Email for .NET 5.2.0 works fine with EWS client of Office365. I have provide the sample code below here for your reference that contains a test account credentials for your testing. Please test it at your end and share your feedback with us for further assistance.

Code:

IEWSClient client = EWSClient.GetEWSClient(“https:[//outlook.office365.com/ews/exchange.asmx](https://outlook.office365.com/ews/exchange.asmx)”, "UserOne@ASE1982.onmicrosoft.com", “Aspose5678”);

Console.WriteLine(client.ListMessages(client.MailboxInfo.InboxUri).Count);