/** * Obtains a grouped list of item by searching the contents of this folder. * Calling this method results in a call to EWS. * * @param view The view controlling the number of folder returned. * @param groupBy The grouping criteria. * @return A collection of grouped item representing the contents of this * folder. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems(ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, "groupBy"); return this.findItems((SearchFilter) null, view, groupBy); }
/** * Obtains a grouped list of item by searching the contents of this folder. * Calling this method results in a call to EWS. * * @param view The view controlling the number of folder returned. * @param groupBy The grouping criteria. * @return A collection of grouped item representing the contents of this * folder. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems(ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, "groupBy"); return this.findItems((SearchFilter) null, view, groupBy); }
@Override public Set<TaskDto> getAllTasks() throws Exception { // Return a task for each flagged email final Set<TaskDto> results = new HashSet<TaskDto>(); // Take a look at http://blogs.planetsoftware.com // .au/paul/archive/2010/05/20/exchange-web-services-ews-managed-api-ndash-part-2.aspx final SearchFilter.SearchFilterCollection searchFilterCollection = new SearchFilter.SearchFilterCollection( LogicalOperator.Or); searchFilterCollection.add(new SearchFilter.IsEqualTo(PR_FLAG_STATUS, "1")); // Flagged complete searchFilterCollection.add(new SearchFilter.IsEqualTo(PR_FLAG_STATUS, "2")); // Flagged final ItemView itemView = new ItemView(MAX_RESULTS); itemView.setPropertySet(createEmailPropertySet()); final FindItemsResults<Item> items = getAllItemsFolder().findItems(searchFilterCollection, itemView); for (final Item email : items.getItems()) { if (email instanceof EmailMessage) { results.add(convertToTaskDto((EmailMessage) email)); } } return results; }