We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exchange web services

When I try to instantiate a new instance, I get an object not set error. I am connecting to a dev exchange install and the cert is a self cert, is there anything else to it?

Hi Chad,

Thank you for contacting Aspose Support team.

We have tested the API by connecting to a test Office 365 account and no issue is raised. The following code has been used to check this issue at our end. Can you please try it at your end and share your feedback with us? There is nothing else to do for connecting to Exchange Server.

Code:

IEWSClient client = EWSClient.GetEWSClient(“[https://outlook.office365.com/ews/exchange.asmx",“UserTwo@ASE1987.onmicrosoft.com”,"Aspose1234](https://outlook.office365.com/ews/exchange.asmx%22,%22UserTwo@ASE1987.onmicrosoft.com%22,%22Aspose1234)”, “”);

ExchangeMessageInfoCollection msgsColl = client.ListMessages(client.MailboxInfo.DraftsUri);

foreach (ExchangeMessageInfo msgInfo in msgsColl)
{
Console.WriteLine(msgInfo.Subject);
}
Self cert failure on Exchange web services call.

The issue is due to the self cert and the Aspose API doesn't, as far as I know, have a way to intercept the cert validation failure. If you put this line in before the Aspose call you will be good to go.

System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

I found this online somewhere, I didn't come up with it myself.

This will ensure no cert is verified, so make sure you have a bool to enable it or disable it in the config file or somewhere. If you leave it in production code, you will be opening your self to a Man in the Middle attack.

Hi Chad,


Yes, this is required when we need to to ignore or bypass an invalid or Expired certificate on Exchange Server as mentioned here. Please let us know if we can be of any additional help to you in this regard.