Reputation: 135
I am trying to connect with email box by EWS. And after that line:
service1.AutodiscoverUrl(emailAdress);
this code throw error
Message = "The Autodiscover service returned an error"
InnerException = " "
TargetSite = "Boolean TryLastChanceHostRedirection[TSettings] (System.String, System.Uri, TSettings ByRef)"
HelpLink = ""
This code is working for another email box on other domain.
I think that something is wrong with Exchange serwer.
Upvotes: 1
Views: 3172
Reputation: 3475
The Autodiscover service is providing a redirection. Try adding this callback as the second argument in the Autodiscover URL method:
static bool RedirectionCallback(string url)
{
// Return true if the URL is an HTTPS URL.
return url.ToLower().StartsWith("https://");
}
Upvotes: 2