locked
Using AutodiscoverService to connect to Exchange using Office 365 online failing RRS feed

  • Question

  • Hi,

    Trying to see if its possible to communicate to Exchange 2013 with an Office 365 online set up, but can't even get past the autodiscover stage. I'm using the following code:

    ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
    
    AutodiscoverService autodiscover = new AutodiscoverService("company.com");
    
    autodiscover.RedirectionUrlValidationCallback = RedirectionUrlValidationCallback;
    
    autodiscover.Credentials = new WebCredentials("user1@company.com", "password");
    
    autodiscover.TraceEnabled = true;
    
    GetUserSettingsResponse response = autodiscover.GetUserSettings(
                   "user1@company.com",
                   UserSettingName.ExternalEwsUrl,
                   UserSettingName.InternalEwsUrl);

    But on the call to GetUserSettings I just get an AutodiscoverLocalException saying "No appopriate Autodiscover SOAP or WS-Security endpoint is available".

    The callbacks are pointing to functions copied from samples that basically just perform some basic validation (but even if I make them always return true it makes no difference)

    What am I missing?

    Wednesday, April 24, 2013 3:31 PM

Answers

  • It sounds like you haven't configured DNS correctly for your domain (would need to see the Trace data to tell for sure) you can test you domain at https://www.testexchangeconnectivity.com/.

    Even if you haven't configured DNS correctly (or your running a hybrid setup etc where that would be valid). If you use the Exchange Online autodiscover endpoint directly, disable the SCPlookup and you have a Office365 mailbox then that should work eg

                        AutodiscoverService adAutoDiscoverService = new AutodiscoverService(ExchangeVersion.Exchange2010_SP1);
                        adAutoDiscoverService.Url = new Uri(" https://autodiscover-s.outlook.com/autodiscover/autodiscover.svc");
                        adAutoDiscoverService.Credentials = new NetworkCredential(UserName, Password);
                        adAutoDiscoverService.EnableScpLookup = false;
                        adAutoDiscoverService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
                        adAutoDiscoverService.PreAuthenticate = true;
                        adAutoDiscoverService.KeepAlive = false;
                        GetUserSettingsResponse adResponse = adAutoDiscoverService.GetUserSettings(emEmailAddress, (new UserSettingName[1] { UserSettingName.ExternalEwsUrl }));

    Cheers
    Glen

     
    • Marked as answer by RJP1973 Thursday, April 25, 2013 8:47 AM
    Thursday, April 25, 2013 5:15 AM

All replies

  • It sounds like you haven't configured DNS correctly for your domain (would need to see the Trace data to tell for sure) you can test you domain at https://www.testexchangeconnectivity.com/.

    Even if you haven't configured DNS correctly (or your running a hybrid setup etc where that would be valid). If you use the Exchange Online autodiscover endpoint directly, disable the SCPlookup and you have a Office365 mailbox then that should work eg

                        AutodiscoverService adAutoDiscoverService = new AutodiscoverService(ExchangeVersion.Exchange2010_SP1);
                        adAutoDiscoverService.Url = new Uri(" https://autodiscover-s.outlook.com/autodiscover/autodiscover.svc");
                        adAutoDiscoverService.Credentials = new NetworkCredential(UserName, Password);
                        adAutoDiscoverService.EnableScpLookup = false;
                        adAutoDiscoverService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
                        adAutoDiscoverService.PreAuthenticate = true;
                        adAutoDiscoverService.KeepAlive = false;
                        GetUserSettingsResponse adResponse = adAutoDiscoverService.GetUserSettings(emEmailAddress, (new UserSettingName[1] { UserSettingName.ExternalEwsUrl }));

    Cheers
    Glen

     
    • Marked as answer by RJP1973 Thursday, April 25, 2013 8:47 AM
    Thursday, April 25, 2013 5:15 AM
  • Ah, it was the url setting I was missing - something not mentioned in any of the other examples I've seen. Just this line alone was enough to make it work (though I'll do some more research on the other settings you've used there).

    Is this url setting something required only for Exchange Online?

    Thursday, April 25, 2013 8:34 AM