title: EWS autodiscoverUrl office365 The Autodiscover service couldn't be located
body: <p>I'm using adal4j to auth on Azure with x509 certificate to get access to all mailboxes on same tenant of Office365. I success get auth token from adal4j and use it for auth.</p>
  
  <pre><code>TokenCredentials tokenCredentials = new TokenCredentials(authRes.getAccessToken());
  
                  @SuppressWarnings("resource")
                  ExchangeService service = new ExchangeService();
                  service.setTraceEnabled(true);
                  service.autodiscoverUrl("jamie@archiva360.com", new IAutodiscoverRedirectionUrl() {
                      @Override
                      public boolean autodiscoverRedirectionUrlValidationCallback(String arg0)
                              throws AutodiscoverLocalException {
                          // TODO Auto-generated method stub
                          return true;
                      }
                  });
                  service.setCredentials(tokenCredentials);
  </code></pre>
  
  <p>Problem here, that I get an exception: </p>
  
  <pre><code>microsoft.exchange.webservices.data.autodiscover.exception.AutodiscoverLocalException: The Autodiscover service couldn't be located.
  at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetLegacyUserSettings(AutodiscoverService.java:743)
  at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getLegacyUserSettings(AutodiscoverService.java:520)
  at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetLegacyUserSettings(AutodiscoverService.java:960)
  at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1846)
  at microsoft.exchange.webservices.data.core.ExchangeService.getAutodiscoverUrl(ExchangeService.java:3611)
  at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3570)
  at com.stimulus.archiva.connect.exchange.OAuth2.main(OAuth2.java:66)
  </code></pre>
  
  <p>I'm added to hosts 
  autodiscover.outlook.com archiva360.com</p>
  
  <p>But it doesn't help. Any clue how can I auth with token and access Office365 with EWS for java. </p>
  
  <p>Regards,
  Valentin</p>