Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

ews-java-api cannot initialize ExchangeService #749

Open
pipibilibili opened this issue Dec 6, 2021 · 1 comment
Open

ews-java-api cannot initialize ExchangeService #749

pipibilibili opened this issue Dec 6, 2021 · 1 comment

Comments

@pipibilibili
Copy link

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
ExchangeCredentials credentials = new WebCredentials("[email protected]", "xxxxx");
service.setCredentials(credentials);
service.autodiscoverUrl("[email protected]");

Exception in thread "main" microsoft.exchange.webservices.data.autodiscover.exception.AutodiscoverLocalException: The Autodiscover service couldn't be located.
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetLegacyUserSettings(AutodiscoverService.java:742)
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getLegacyUserSettings(AutodiscoverService.java:521)
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.internalGetLegacyUserSettings(AutodiscoverService.java:959)
at microsoft.exchange.webservices.data.autodiscover.AutodiscoverService.getUserSettings(AutodiscoverService.java:1846)
at microsoft.exchange.webservices.data.core.ExchangeService.getAutodiscoverUrl(ExchangeService.java:3615)
at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3572)
at microsoft.exchange.webservices.data.core.ExchangeService.autodiscoverUrl(ExchangeService.java:3522)
at EwsTest.main(EwsTest.java:29)

@ThangLeQuoc
Copy link

ThangLeQuoc commented Dec 20, 2021

Possibly your credential initialization is wrong, did you try the alternative contructor with domain?

ExchangeCredentials ewsCredential = new WebCredentials(ewsUserName, ewsPassword, ewsDomain);  
exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP1);	 
exchangeService.setCredentials(ewsCredential);  

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants