Sunday, 15 September 2013

email - Windows Service C#: Accessing Mail. The Autodiscover service couldn't be located -



email - Windows Service C#: Accessing Mail. The Autodiscover service couldn't be located -

i have tried both methods below both homecoming result "the autodiscover service couldn't located."

http://msdn.microsoft.com/en-us/library/gg591267(v=exchg.140).aspx

service.credentials = new networkcredential(userdata.emailaddress, userdata.password); if (userdata.autodiscoverurl == null) { service.autodiscoverurl(userdata.emailaddress, redirectionurlvalidationcallback); userdata.autodiscoverurl = service.url; } else { service.url = userdata.autodiscoverurl; } homecoming service; }

http://code.msdn.microsoft.com/exchange-2013-set-pull-14c8360b#content

static exchangeservice getbinding() { // create binding. exchangeservice service = new exchangeservice(exchangeversion.exchange2010_sp1); // define credentials. service.credentials = new webcredentials("myemail@work.com", "password"); // utilize autodiscoverurl method locate service endpoint. seek { service.autodiscoverurl("myemail@work.com", redirectionurlvalidationcallback); } grab (autodiscoverremoteexception ex) { console.writeline("exception thrown: " + ex.error.message); } // display service url. console.writeline("autodiscoverurl: " + service.url); homecoming service; }

in 1 instance come in email , password, in other hard-coded. both hang when attempting autodiscoverurl , fail message "the autodiscover service couldn't located." added references per tutorials , autodiscover appears under microsoft.exchange.webservices.dll ... there else i'm missing?

try adding:

service.usedefaultcredentials = false;

after set credentials

c# email exchange-server exchangewebservices

No comments:

Post a Comment