'Autodiscover service couldn't be located' when trying to access Exchange 2010 account with EWS MANAGED API

前端 未结 11 1494
臣服心动
臣服心动 2020-12-28 12:32

I am using Auto discover service Url for a specified e-mail address.

ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2010);
Service.Cr         


        
相关标签:
11条回答
  • 2020-12-28 13:28

    I experienced the same problem with Exchange 2013. In my case the cause was a Default Proxy declaration in my config file, which probably prevented the Autodiscover service to work correctly.

    <system.net>
        <defaultProxy enabled="true">
          <proxy proxyaddress="http://localhost:8888" bypassonlocal="False"/>
        </defaultProxy>
    </system.net>
    

    After commenting the <defaultProxy> tag, autodiscover was able to find the service Url.

    0 讨论(0)
  • 2020-12-28 13:30

    I have used direct:

    Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx")
    

    and it worked for me. You may try use Fiddler and eM Client to see how they use EWS Managed API to get things done and replicate calls.

    0 讨论(0)
  • 2020-12-28 13:33

    You got Service.Credentials wrong, use it like this:

    Service.Credentials = new WebCredentials(username, password, domainname);
    

    Using domain credentials, not the email address.

    Also doublecheck the following:

    1. The version you specify in new ExchangeService() matches server's
    2. the parameter passed to Service.AutodiscoverUrl(); is correct (email address which data needs to be fetched)

    The following works for me (in a new Console Application):

    // Tweaked to match server version
    ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); 
    
    // Dummy but realistic credentials provided below
    Service.Credentials = new WebCredentials("john", "12345678", "MYDOMAIN");
    Service.AutodiscoverUrl("john.smith@mydomain.it");
    Folder inbox = Folder.Bind(Service, WellKnownFolderName.Inbox);
    Console.WriteLine("The folder name is " + inbox.DisplayName.ToString());
    
    //Console output follows (IT localized environment, 'Posta in arrivo' = 'Inbox')
    > The folder name is Posta in arrivo
    
    0 讨论(0)
  • 2020-12-28 13:34

    I will recommend to you to enable Traces,to achieve this follow :

         Service.TraceEnabled = true;
    

    I was facing the same issue then when I enabled traces these traces will guide you what exactly is happening.In my case SSL certificate issue is there to solve it i followed following post

    There can be many issue such as:

    • User can be blocked.
    • The DNS can't find autodiscover.domain.com.
    0 讨论(0)
  • 2020-12-28 13:35

    Check if the password for this email has expired.

    If the password has expired you receive this error from AutoDiscover.

    0 讨论(0)
提交回复
热议问题