This is my scenario: I have to read email from exchange 2010 sp2 accounts. I have to use Exchange Web Services, POP3 and IMAP are blocked. I have to test my app in an enviro
This works like a charm to me:
var exchange = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
var username = Settings.EmailUserName;
var password = Settings.EmailPassword;
var domain = Settings.EmailDomain;
var email = Settings.Email;
exchange.Credentials = new WebCredentials(email, password);
exchange.AutodiscoverUrl(email, RedirectionCallback);
and the RedirectionCallback is:
static bool RedirectionCallback(string url)
{
// Return true if the URL is an HTTPS URL.
return url.ToLower().StartsWith("https://");
}
heres is the link: https://msdn.microsoft.com/en-us/library/office/dd635285(v=exchg.80).aspx
Regards!