/** * Initializes the Url property to the Exchange Web Services URL for the * specified e-mail address by calling the Autodiscover service. * * @param emailAddress the email address * @throws Exception the exception */ public void autodiscoverUrl(String emailAddress) throws Exception { this.autodiscoverUrl(emailAddress, this); }
protected ExchangeService initializeIfNecessary(ProcessContext context) throws ProcessException { ExchangeVersion ver = ExchangeVersion.valueOf(context.getProperty(EXCHANGE_VERSION).getValue()); ExchangeService service = new ExchangeService(ver); final String timeoutInMillis = String.valueOf(context.getProperty(CONNECTION_TIMEOUT).evaluateAttributeExpressions().asTimePeriod(TimeUnit.MILLISECONDS)); service.setTimeout(Integer.parseInt(timeoutInMillis)); String userEmail = context.getProperty(USER).evaluateAttributeExpressions().getValue(); String password = context.getProperty(PASSWORD).evaluateAttributeExpressions().getValue(); ExchangeCredentials credentials = new WebCredentials(userEmail, password); service.setCredentials(credentials); Boolean useAutodiscover = context.getProperty(USE_AUTODISCOVER).asBoolean(); if(useAutodiscover){ try { service.autodiscoverUrl(userEmail, new RedirectionUrlCallback()); } catch (Exception e) { throw new ProcessException("Failure setting Autodiscover URL from email address.", e); } } else { String ewsURL = context.getProperty(EWS_URL).getValue(); try { service.setUrl(new URI(ewsURL)); } catch (URISyntaxException e) { throw new ProcessException("Failure setting EWS URL.", e); } } return service; }
/** * Initializes the Url property to the Exchange Web Services URL for the * specified e-mail address by calling the Autodiscover service. * * @param emailAddress the email address * @throws Exception the exception */ public void autodiscoverUrl(String emailAddress) throws Exception { this.autodiscoverUrl(emailAddress, this); }
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); ExchangeCredentials credentials = new WebCredentials(userName, password); service.setCredentials(credentials); service.autodiscoverUrl(autoDiscoverUrl); service.setTraceEnabled(true); ItemView view = new ItemView(20); FindItemsResults<Item> findResults; do { findResults = service.findItems(WellKnownFolderName.RecoverableItemsDeletions, view); for (Item item : findResults.getItems()) { System.out.println(item); } view.setOffset(view.getOffset() + 20); } while (findResults.isMoreAvailable());
exchangeService.setTraceEnabled(true); exchangeService.setEnableScpLookup(true); exchangeService.autodiscoverUrl(email, new RedirectionUrlCallback()); } catch (Exception usernameException) { // NOSONAR - EWS Java API throws Exception, that's life LOG.info(String.format( exchangeService.setTraceEnabled(true); exchangeService.setEnableScpLookup(true); exchangeService.autodiscoverUrl(email, new RedirectionUrlCallback()); } catch (Exception usernameDomainException) { // NOSONAR - EWS Java API throws Exception, that's life LOG.info(String.format( exchangeService.setTraceEnabled(true); exchangeService.setEnableScpLookup(true); exchangeService.autodiscoverUrl(email, new RedirectionUrlCallback()); } catch (Exception emailException) { // NOSONAR - EWS Java API throws Exception, that's life LOG.warn(String.format(
protected ExchangeService initializeIfNecessary(ProcessContext context) throws ProcessException { ExchangeVersion ver = ExchangeVersion.valueOf(context.getProperty(EXCHANGE_VERSION).getValue()); ExchangeService service = new ExchangeService(ver); final String timeoutInMillis = String.valueOf(context.getProperty(CONNECTION_TIMEOUT).evaluateAttributeExpressions().asTimePeriod(TimeUnit.MILLISECONDS)); service.setTimeout(Integer.parseInt(timeoutInMillis)); String userEmail = context.getProperty(USER).evaluateAttributeExpressions().getValue(); String password = context.getProperty(PASSWORD).evaluateAttributeExpressions().getValue(); ExchangeCredentials credentials = new WebCredentials(userEmail, password); service.setCredentials(credentials); Boolean useAutodiscover = context.getProperty(USE_AUTODISCOVER).asBoolean(); if(useAutodiscover){ try { service.autodiscoverUrl(userEmail, new RedirectionUrlCallback()); } catch (Exception e) { throw new ProcessException("Failure setting Autodiscover URL from email address.", e); } } else { String ewsURL = context.getProperty(EWS_URL).getValue(); try { service.setUrl(new URI(ewsURL)); } catch (URISyntaxException e) { throw new ProcessException("Failure setting EWS URL.", e); } } return service; }