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

Free Support Forum - aspose.com

Exchange 2013 - (405) Method Not Allowed error

Hi

When I use Aspose email 4.7 to connect to a mailbox I get the following error.

Aspose.Email.Exchange.ExchangeException was unhandled

_HResult=-2146233088

_message=The remote server returned an error: (405) Method Not Allowed.

Code is

ExchangeClient client = new ExchangeClient(“https://server/ews/Exchange.asmx”, “username”, “password”, “domain”);
ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();

When I use Microsoft.Exchange.WebServices 2.2 with the same credentials and URL it connects

Hi Joe,

Thank you for sharing your concern with Aspose support team.

I have noticed that you are using the ExchagneClient class to connect to Exchange Server 2013 which is not the right way as this class is used to connect to servers supporting WebDAV protocol (Exchange Server 2007 & 2010). Exchange Server 2013 doesn’t support the WebDav protocol. Please use the IEWSClient interface (that uses Exchange Web Service) as shown in our documentation article Connecting to Exchange Server for use with Exchange Server 2013.

Sample Code:

const string mailboxUri = “https://server/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);