Reputation: 13
I'm trying to start work with EWS using EWS-Api-2.1 nuget package. Below is simple code I'm using:
ExchangeService _service = new ExchangeService();
_service.Credentials = new WebCredentials("mail", "password");
_service.AutodiscoverUrl("mail", url => false);//_service.AutodiscoverUrl("mail") Both variants fails
var appointment = new Appointment(_service);
appointment.Subject = "Status Meeting";
appointment.Body = "The purpose of this meeting is to discuss status.";
appointment.Start = DateTime.Now.AddHours(1);
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "Conf Room";
appointment.RequiredAttendees.Add("mail1");
appointment.Save(SendInvitationsMode.SendToNone);
As result I have:
HTTP/1.1 502 Fiddler - Connection Failed
[Fiddler] The connection to 'autodiscover.domain.com' failed.
Error: ConnectionRefused (0x274d). System.Net.Sockets.SocketException
No connection could be made because the target machine actively refused it 157.56.248.169:443
In DNS management I have the following:
Initial domain: This domain is included with your account. It’s set up automatically for you, and you can’t delete it.
Upvotes: 0
Views: 1260
Reputation: 17702
If you want to find out why Autodiscover is failing, I would recommend enabling tracing with all of the Autodiscover-related trace tags. Of course I'm assuming that the value "mail" that you're passing there is actually the user's email address.
Upvotes: 2