Haifisch7734

Untitled

Aug 21st, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. @Configuration
  2. @ConfigurationProperties(prefix = "spring.exchange")
  3. public class MSExchangeConfig {
  4.  
  5.         .
  6.     .
  7.     .
  8.  
  9.     public ExchangeService buildExchangeService() throws ExchangeServiceNotBuiltException {
  10.         ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
  11.         ExchangeCredentials credentials = new WebCredentials(getUsername(), getPassword());
  12.         service.setCredentials(credentials);
  13.         try {
  14.             service.setUrl(new URI(getUri()));
  15.         } catch (URISyntaxException ex) {
  16.             logger.error("URL problem when connecting to Exchange");
  17.             logger.trace("{}", ex);
  18.             throw new ExchangeServiceNotBuiltException();
  19.         }
  20.         return service;
  21.  
  22.     }
  23.  
  24.     .
  25.     .
  26.     .
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment