public Object createServiceObjectWithServiceParam( ExchangeService srv) throws Exception { return new CalendarFolder(srv); } }, null);
/** * Binds to an existing calendar folder and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service the service * @param id the id * @return A CalendarFolder instance representing the calendar folder * corresponding to the specified Id * @throws Exception the exception */ public static CalendarFolder bind(ExchangeService service, FolderId id) throws Exception { return CalendarFolder.bind(service, id, PropertySet .getFirstClassProperties()); }
private CalendarFolder createCalendar(String calendarName) { try { LOG.info(String.format("Trying to create new calendar with name '%s'", calendarName)); CalendarFolder folder = new CalendarFolder(exchangeService); folder.setDisplayName(calendarName); folder.save(WellKnownFolderName.Calendar); LOG.info(String.format("New calendar folder '%s' created.", calendarName)); return CalendarFolder.bind(exchangeService, folder.getId()); } catch (Exception ex) { // NOSONAR - EWS Java API throws Exception, that's life throw new CalendarNotCreatedException(String.format("Exchange calendar '%s' could not be created", calendarName), ex); } }
@Override public Optional<String> add(Absence absence, CalendarSettings calendarSettings) { ExchangeCalendarSettings exchangeCalendarSettings = calendarSettings.getExchangeCalendarSettings(); String calendarName = exchangeCalendarSettings.getCalendar(); connectToExchange(exchangeCalendarSettings); try { CalendarFolder calendarFolder = findOrCreateCalendar(calendarName); Appointment appointment = new Appointment(exchangeService); fillAppointment(absence, appointment); SendInvitationsMode invitationsMode = SendInvitationsMode.SendToNone; if (exchangeCalendarSettings.isSendInvitationActive()) { invitationsMode = SendInvitationsMode.SendToAllAndSaveCopy; } appointment.save(calendarFolder.getId(), invitationsMode); LOG.info(String.format("Appointment %s for '%s' added to exchange calendar '%s'.", appointment.getId(), absence.getPerson().getNiceName(), calendarFolder.getDisplayName())); return Optional.ofNullable(appointment.getId().getUniqueId()); } catch (Exception ex) { // NOSONAR - EWS Java API throws Exception, that's life LOG.warn("An error occurred while trying to add appointment to Exchange calendar"); mailService.sendCalendarSyncErrorNotification(calendarName, absence, ExceptionUtils.getStackTrace(ex)); } return Optional.empty(); }
/** * Obtains a list of appointments by searching the contents of this folder * and performing recurrence expansion for recurring appointments. Calling * this method results in a call to EWS. * * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Appointment> findAppointments(CalendarView view) throws Exception { EwsUtilities.validateParam(view, "view"); ServiceResponseCollection<FindItemResponse<Appointment>> responses = this.internalFindItems((SearchFilter) null, view, null /* groupBy */); return responses.getResponseAtIndex(0).getResults(); }
/** * Obtains a list of appointments by searching the contents of this folder * and performing recurrence expansion for recurring appointments. Calling * this method results in a call to EWS. * * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Appointment> findAppointments(CalendarView view) throws Exception { EwsUtilities.validateParam(view, "view"); ServiceResponseCollection<FindItemResponse<Appointment>> responses = this.internalFindItems((SearchFilter) null, view, null /* groupBy */); return responses.getResponseAtIndex(0).getResults(); }
/** * Binds to an existing calendar folder and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service the service * @param name the name * @param propertySet the property set * @return A CalendarFolder instance representing the calendar folder with * the specified name. * @throws Exception the exception */ public static CalendarFolder bind(ExchangeService service, WellKnownFolderName name, PropertySet propertySet) throws Exception { return CalendarFolder.bind(service, new FolderId(name), propertySet); }
public Object createServiceObjectWithServiceParam( ExchangeService srv) throws Exception { return new CalendarFolder(srv); } }, null);
/** * Binds to an existing calendar folder and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service the service * @param name the name * @return A CalendarFolder instance representing the calendar folder with * the specified name. * @throws Exception the exception */ public static CalendarFolder bind(ExchangeService service, WellKnownFolderName name) throws Exception { return CalendarFolder.bind(service, new FolderId(name), PropertySet .getFirstClassProperties()); }
/** * Binds to an existing calendar folder and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service the service * @param id the id * @return A CalendarFolder instance representing the calendar folder * corresponding to the specified Id * @throws Exception the exception */ public static CalendarFolder bind(ExchangeService service, FolderId id) throws Exception { return CalendarFolder.bind(service, id, PropertySet .getFirstClassProperties()); }
/** * Binds to an existing calendar folder and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service the service * @param name the name * @param propertySet the property set * @return A CalendarFolder instance representing the calendar folder with * the specified name. * @throws Exception the exception */ public static CalendarFolder bind(ExchangeService service, WellKnownFolderName name, PropertySet propertySet) throws Exception { return CalendarFolder.bind(service, new FolderId(name), propertySet); }
/** * Binds to an existing calendar folder and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service the service * @param name the name * @return A CalendarFolder instance representing the calendar folder with * the specified name. * @throws Exception the exception */ public static CalendarFolder bind(ExchangeService service, WellKnownFolderName name) throws Exception { return CalendarFolder.bind(service, new FolderId(name), PropertySet .getFirstClassProperties()); }