FindItemsResults<Item> findResults = service.findItems(folder.getId(), sf, view);
/** * Obtains a grouped list of item by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param <TItem> the generic type * @param cls the cls * @param parentFolderId the parent folder id * @param searchFilter the search filter * @param view the view * @param groupBy the group by * @return A list of item containing the contents of the specified folder. * @throws Exception the exception */ protected <TItem extends Item> ServiceResponseCollection<FindItemResponse<TItem>> findItems( Class<TItem> cls, FolderId parentFolderId, SearchFilter searchFilter, ViewBase view, Grouping groupBy) throws Exception { List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); return this.findItems(folderIdArray, searchFilter, null, /* queryString */ view, groupBy, ServiceErrorHandling.ThrowOnError); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, ItemView view) throws Exception { return this.findItems(new FolderId(parentFolderName), (SearchFilter) null, view); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param searchFilter the search filter * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, SearchFilter searchFilter, ItemView view) throws Exception { return this.findItems(new FolderId(parentFolderName), searchFilter, view); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param queryString the query string * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, String queryString, ItemView view) throws Exception { return this .findItems(new FolderId(parentFolderName), queryString, view); }
/** * Obtains a grouped list of item by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param searchFilter the search filter * @param view the view * @param groupBy the group by * @return A collection of grouped item containing the contents of the * specified. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, SearchFilter searchFilter, ItemView view, Grouping groupBy) throws Exception { return this.findItems(new FolderId(parentFolderName), searchFilter, view, groupBy); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems(FolderId parentFolderId, ItemView view) throws Exception { List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, null, /* searchFilter */ null, /* queryString */ view, null, /* groupBy */ ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getResults(); }
/** * Obtains a list of appointments by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param calendarView the calendar view * @return A collection of appointments representing the contents of the * specified folder. * @throws Exception the exception */ public FindItemsResults<Appointment> findAppointments( FolderId parentFolderId, CalendarView calendarView) throws Exception { List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Appointment>> response = this .findItems(folderIdArray, null, /* searchFilter */ null /* queryString */, calendarView, null, /* groupBy */ ServiceErrorHandling.ThrowOnError); return response.getResponseAtIndex(0).getResults(); }
/** * Obtains a grouped list of item by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param queryString the query string * @param view the view * @param groupBy the group by * @return A collection of grouped item containing the contents of the * specified. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, String queryString, ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, "groupBy"); return this.findItems(new FolderId(parentFolderName), queryString, view, groupBy); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param queryString the query string * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems(FolderId parentFolderId, String queryString, ItemView view) throws Exception { EwsUtilities.validateParamAllowNull(queryString, "queryString"); List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, null, /* searchFilter */ queryString, view, null, /* groupBy */ ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getResults(); }
/** * Find item. * * @param <TItem> The type of the item. * @param queryString query string to be used for indexed search * @param view The view controlling the number of item returned. * @param groupBy The group by. * @return FindItems response collection. * @throws Exception the exception */ <TItem extends Item> ServiceResponseCollection<FindItemResponse<TItem>> internalFindItems(String queryString, ViewBase view, Grouping groupBy) throws Exception { ArrayList<FolderId> folderIdArry = new ArrayList<FolderId>(); folderIdArry.add(this.getId()); this.throwIfThisIsNew(); return this.getService().findItems(folderIdArry, null, /* searchFilter */ queryString, view, groupBy, ServiceErrorHandling.ThrowOnError); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param searchFilter the search filter * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems(FolderId parentFolderId, SearchFilter searchFilter, ItemView view) throws Exception { EwsUtilities.validateParamAllowNull(searchFilter, "searchFilter"); List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, searchFilter, null, /* queryString */ view, null, /* groupBy */ ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getResults(); }
/** * Obtains a grouped list of item by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param view the view * @param groupBy the group by * @return A list of item containing the contents of the specified folder. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems(FolderId parentFolderId, ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, "groupBy"); List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, null, /* searchFilter */ null, /* queryString */ view, groupBy, ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getGroupedFindResults(); }
/** * Find item. * * @param <TItem> The type of the item. * @param searchFilter The search filter. Available search filter classes include * SearchFilter.IsEqualTo, SearchFilter.ContainsSubstring and * SearchFilter.SearchFilterCollection * @param view The view controlling the number of item returned. * @param groupBy The group by. * @return FindItems response collection. * @throws Exception the exception */ <TItem extends Item> ServiceResponseCollection<FindItemResponse<TItem>> internalFindItems(SearchFilter searchFilter, ViewBase view, Grouping groupBy) throws Exception { ArrayList<FolderId> folderIdArry = new ArrayList<FolderId>(); folderIdArry.add(this.getId()); this.throwIfThisIsNew(); return this.getService().findItems(folderIdArry, searchFilter, null, /* queryString */ view, groupBy, ServiceErrorHandling.ThrowOnError); }
/** * Obtains a grouped list of item by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param queryString the query string * @param view the view * @param groupBy the group by * @return A list of item containing the contents of the specified folder. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems(FolderId parentFolderId, String queryString, ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, "groupBy"); EwsUtilities.validateParamAllowNull(queryString, "queryString"); List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, null, /* searchFilter */ queryString, view, groupBy, ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getGroupedFindResults(); }
/** * Obtains a grouped list of item by searching the contents of a specific * folder. Calling this method results in a call to EWS. * * @param parentFolderId the parent folder id * @param searchFilter the search filter * @param view the view * @param groupBy the group by * @return A list of item containing the contents of the specified folder. * @throws Exception the exception */ public GroupedFindItemsResults<Item> findItems(FolderId parentFolderId, SearchFilter searchFilter, ItemView view, Grouping groupBy) throws Exception { EwsUtilities.validateParam(groupBy, "groupBy"); EwsUtilities.validateParamAllowNull(searchFilter, "searchFilter"); List<FolderId> folderIdArray = new ArrayList<FolderId>(); folderIdArray.add(parentFolderId); ServiceResponseCollection<FindItemResponse<Item>> responses = this .findItems(folderIdArray, searchFilter, null, /* queryString */ view, groupBy, ServiceErrorHandling.ThrowOnError); return responses.getResponseAtIndex(0).getGroupedFindResults(); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, ItemView view) throws Exception { return this.findItems(new FolderId(parentFolderName), (SearchFilter) null, view); }
/** * Obtains a list of item by searching the contents of a specific folder. * Calling this method results in a call to EWS. * * @param parentFolderName the parent folder name * @param searchFilter the search filter * @param view the view * @return An object representing the results of the search operation. * @throws Exception the exception */ public FindItemsResults<Item> findItems( WellKnownFolderName parentFolderName, SearchFilter searchFilter, ItemView view) throws Exception { return this.findItems(new FolderId(parentFolderName), searchFilter, view); }
ExchangeService service = new ExchangeService(); //login to your exchange server with credentials etc & set your service url ..... //issue your search for a given user using EmailMesssageSchema.From FindItemsResults <Item> results = service.findItems(WellKnownFolderName.Inbox, new SearchFilter.IsEqualTo(EmailMessageSchema.From, "SomeUser"), new ItemView(100));
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());