John Chapman
John Chapman

Reputation: 898

Autodiscover Issues with Exchange Managed API

I am using the Exchange Managed API in C# to access Exchange 2010. I am having issues with using the Autodiscoverurl function. I have tried a number of different methods with various different errors:

Code:

var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Autodiscoverurl("[email protected]", delegate { return true; });

Error:

The Autodiscover service couldn't be located.

Code:

var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Autodiscoverurl("[email protected]");

Error:

Autodiscover blocked a potentially insecure redirection to https:// servername /autodiscover/autodiscover.xml. To allow Autodiscover to follow the redirection, use the AutodiscoverUlr(string, AutodiscoverRedirectionUrlValidationCallback) overload.

Code:

var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Url = new Uri("https://servername/EWS/Exchange.asmx");

Error:

The request failed. The remote server returned an error: (401) Unauthorized.

I have tried various ways of providing credentials, all with the same results as above.

service.UseDefaultCredentials = true;
service.Credentials = CredentialCache.DefaultNetworkCredentials;
etc.

Any ideas?

Upvotes: 3

Views: 5713

Answers (1)

ZZ9
ZZ9

Reputation: 2237

From what I understand, the autodiscover xml requires credentials, if Basic doesn't work NTLM is usually more reliable.

Upvotes: 1

Related Questions