The simplest thing I want in my company - is to retrieve mails. I tried over Imap - no success, (ImapX not connecting at all and no error is shown) and I came to EWS.
But there is also some voo-doo magic involved. And here is the code with some errors:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.UseDefaultCredentials = true;
service.Url = new Uri("https://some.com/EWS/Exchange.asmx"); // The request failed. Unable to connect to the remote server
var folder = Folder.Bind(service, WellKnownFolderName.Inbox);
///////////////////another try
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.UseDefaultCredentials = true;
service.AutodiscoverUrl("someone@some.com"); // Discover server not found
var folder = Folder.Bind(service, WellKnownFolderName.Inbox);
However, I'm able to connect to wsdl version:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
service.UseDefaultCredentials = true;
service.Url = new Uri("https://some.com:444/EWS/Services.wsdl");//Wow! It worked.
var folder = Folder.Bind(service, WellKnownFolderName.Inbox);//duh, Method Not Allowed ........
return null;
How the heck do I connect to EWS? I'm able to connect through Outlook, and aquired all this addresses from its Autodiscover.xml file of my domain account. This question blowing my head.
UPDATE
Here is example with IMAP server:
var client = new ImapX.ImapClient("imap.some.com", 993, true);
client.Connect(); //just do nothing. nothing is connected, no errors.