private boolean deleteItems(final Folder folder, final SearchFilter filter) throws Exception { final ItemView view = new ItemView(500); view.setPropertySet(PropertySet.IdOnly); final FindItemsResults<Item> items = folder.findItems(filter, view); if (items.getTotalCount() > 0) { final Iterable<ItemId> itemIds = Iterables.transform(items, ItemToItemId.INSTANCE); folder .getService() .deleteItems( itemIds, deleteMode, SendCancellationsMode.SendToNone, AffectedTaskOccurrence.SpecifiedOccurrenceOnly); } return items.isMoreAvailable(); }
private List<Appointment> initAllAppointments(FindItemsResults<Appointment> appointments) throws Exception { List<Appointment> list = Lists.newArrayList(); for (final Appointment appt : appointments.getItems()) { appt.load(); list.add(appt); } return list; }