FindItemsWithFolderIdAndQueryAndHighlightAndViewAndGrouping method

Future<GroupedFindItemsResults<Item>?> FindItemsWithFolderIdAndQueryAndHighlightAndViewAndGrouping(
  1. FolderId parentFolderId,
  2. String queryString,
  3. bool returnHighlightTerms,
  4. ViewBase view,
  5. Grouping groupBy,
)
Obtains a list of items by searching the contents of a specific folder. Along with conversations, a list of highlight terms are returned. Calling this method results in a call to EWS. The Id of the folder in which to search for items. the search string to be used for indexed search, if any. Flag indicating if highlight terms should be returned in the response The view controlling the number of items returned. The group by clause.

Implementation

Future<GroupedFindItemsResults<Item>?>
    FindItemsWithFolderIdAndQueryAndHighlightAndViewAndGrouping(
        FolderId parentFolderId,
        String queryString,
        bool returnHighlightTerms,
        ViewBase view,
        Grouping groupBy) async {
  List<FolderId> parentFolderIds = [parentFolderId];

  EwsUtilities.ValidateParamCollection(parentFolderIds, "parentFolderIds");
  EwsUtilities.ValidateParam(view, "view");
  EwsUtilities.ValidateParam(groupBy, "groupBy");
  EwsUtilities.ValidateParamAllowNull(queryString, "queryString");
  EwsUtilities.ValidateParamAllowNull(
      returnHighlightTerms, "returnHighlightTerms");
  EwsUtilities.ValidateMethodVersion(
      this, ExchangeVersion.Exchange2013, "FindItems");

  FindItemRequest<Item> request =
      new FindItemRequest<Item>(this, ServiceErrorHandling.ThrowOnError);

  request.ParentFolderIds.AddRangeFolderIds(parentFolderIds);
  request.QueryString = queryString;
  request.ReturnHighlightTerms = returnHighlightTerms;
  request.View = view;
  request.GroupBy = groupBy;

  ServiceResponseCollection<FindItemResponse<Item>> responses =
      await request.Execute();
  return responses[0].GroupedFindResults;
}