public ExchangeProvider(String fromAddress, String fromName, String password) { ExchangeService service = new ExchangeService(); ExchangeCredentials credentials = new WebCredentials(fromAddress, password); service.setCredentials(credentials); try { service.autodiscoverUrl(fromAddress, new ExchangeRedirection()); } catch (Exception e) { System.out.println("Exception from the autodiscoverUrl method call. Exiting."); System.exit(1); } this.service = service; }
public void login(Properties properties) throws Exception { String exchangeEmail = properties.getProperty("exchange.email"); String exchangePassword = properties.getProperty("exchange.password"); // String exchangeUrl = properties.getProperty("exchange.url"); Assert.notNull(exchangeEmail, "Exchange email is null. Please provide a valid email."); Assert.notNull(exchangePassword, "Exchange password is null. Please provide a valid password."); // Assert.notNull(exchangeUrl, "Exchange url is null. Please provide a valid url to connect."); exchangeService = new ExchangeService(ExchangeVersion.Exchange2007_SP1); // exchangeService = new ExchangeService(); ExchangeCredentials credentials = new WebCredentials(exchangeEmail, exchangePassword); exchangeService.setCredentials(credentials); // service.setUrl(URI.create(exchangeUrl)); exchangeService.autodiscoverUrl(exchangeEmail, new RedirectionUrlCallback()); isLoggedIn = true; }