EWS autodiscoverUrl office365无法找到自动发现服务

时间:2015-05-21 16:38:07

标签: java office365 exchangewebservices adal

我使用adal4j在Azure上使用x509证书进行身份验证,以访问Office365同一租户上的所有邮箱。我成功从adal4j获取身份验证令牌并将其用于身份验证。

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);

问题在于,我得到一个例外:

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)

我已加入主持人 autodiscover.outlook.com archiva360.com

但它没有帮助。任何线索我如何使用令牌进行身份验证并使用EWS for java访问Office365。

此致 的Valentin

0 个答案:

没有答案