Please help me out sruggling in this for a long time..
error: The Autodiscover service couldn't be located.
my code is
try
{
// Connect to Exchange Web Services as user1 at contoso.com.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
service.Credentials = new WebCredentials("ews@MydomainName.com", "password");
//service.UseDefaultCredentials = true;
service.AutodiscoverUrl("ews2@MydomainName.com", ValidateRedirectionUrlCallback);
//service.Url = new Uri("https://serverName.DomainName.com/ews/Exchange.asmx");
// Create the e-mail message, set its properties, and send it touser2@contoso.com, saving a copy to the Sent Items folder.
EmailMessage message = new EmailMessage(service);
message.Subject = "Interesting";
message.Body = "The proposition has been considered.";
message.ToRecipients.Add("ews1@MydomainName.com");
message.SendAndSaveCopy();
// Write confirmation message to console window.
//Console.WriteLine("Message sent!");
//Console.ReadLine();
}
catch (Exception ex)
{
//Console.WriteLine("Error: " + ex.Message);
//Console.ReadLine();
}
i browsed-
https://MyserverName.DomainName.com/autodiscover/autodiscover.xml
it displays
<?xml version="1.0" encoding="utf-8" ?>
- <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
- <Response>
- <Error Time="17:35:23.3125000" Id="3155127929">
<ErrorCode>600</ErrorCode>
<Message>Invalid Request</Message>
<DebugData />
</Error>
</Response>
</Autodiscover>
please give me a right solution for this as soon as faster