E2013 EWSMA C# Windows7 Autodiscover service couldn't be located RRS feed

  • Question

  • I'm building an app that will run in production on a Windows Server 2008 R2 web server.
    It should connect to a shared mailbox using a Windows service account that is in an AD group that has access to the shared mailbox.  My network login has access to the shared mailbox.  When I call the EWSMA AutodiscoverUrl method with my login name and password, it connects just fine and I can see everything in that mailbox.  When I call it with the service account info, it tells me "The Autodiscover service couldn't be located."

    public ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
    Service.Credentials = new WebCredentials("me@confused.com", "password");
    Service.AutodiscoverUrl("me@confused.com", RedirectionCallback);
    SharedMailboxName = "thesharedmailboxname";    
    static bool RedirectionCallback(string url)
        // Return true if the URL is an HTTPS URL.
        return url.ToLower().StartsWith("https://");

    I'm told that our company is now using Office365 and Exchange in the cloud but I don't see any differences in suggested code based on that.  I have tried calling WebCredentials with every variation of username and domain that has been suggested, and get the same result. I'm now reduced to poking it with a stick.  Any ideas?

    Monday, April 24, 2017 5:45 PM

All replies

  • Does the Service Account have a Mailbox ? If they are using Office365 its mostly likely they haven't assigned a licence to the Service Account (because of the cost) hence it won't be able to logon. Also you can skip Autodiscover with Office365 and just use the load balanced endpoint  https://outlook.office365.com/EWS/Exchange.asmx  if you want to test the account.


    Thursday, April 27, 2017 12:40 AM