I am working of winform application. I want to login with exchange account with Autodiscover mechanisam. I have tried almost functionality but I keep getting error.
This is my code.
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
Service.Credentials = new WebCredentials("abc", "12345678", "mydomain.net");
Service.TraceEnabled = true;
Service.UseDefaultCredentials = false;
Service.EnableScpLookup = false;
Service.AutodiscoverUrl("
[email protected]", delegate
{
return true;
});
//Service.Url = new Uri("HTTPS://smtp1.mydomain.net/EWS/Exchange.asmx");
Folder inbox = Folder.Bind(Service, WellKnownFolderName.Inbox);
Console.WriteLine("The folder name is " + inbox.DisplayName.ToString());
//===================================
AutodiscoverLocalException was cought : The Autodiscover service couldn't be located.