NJ  Bhanushali

NJ Bhanushali

  • NA
  • 13
  • 15.2k

Login Exchange : The Autodiscover service couldn't be locate

Jun 5 2015 12:01 AM
Hello,
 
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.
Domain Name : mydomain.net
Account Name: [email protected]
Password : 12345678
 
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());
//===================================

But i keep get error :
AutodiscoverLocalException was cought : The Autodiscover service couldn't be located.