ApplyConversationAction method

Future<ServiceResponseCollection<ServiceResponse>> ApplyConversationAction(
  1. ConversationActionType actionType,
  2. Iterable<ConversationId> conversationIds,
  3. bool processRightAway,
  4. StringList? categories,
  5. bool enableAlwaysDelete,
  6. FolderId? destinationFolderId,
  7. ServiceErrorHandling errorHandlingMode,
)
Applies ConversationAction on the specified conversation. ConversationAction The conversation ids. True to process at once . This is blocking and false to let the Assistant process it in the back ground Catgories that need to be stamped can be null or empty True moves every current and future messages in the conversation to deleted items folder. False stops the alwasy delete action. This is applicable only if the action is AlwaysDelete Applicable if the action is AlwaysMove. This moves every current message and future message in the conversation to the specified folder. Can be null if tis is then it stops the always move action The error handling mode.

Implementation

Future<ServiceResponseCollection<ServiceResponse>> ApplyConversationAction(
  ConversationActionType actionType,
  Iterable<ConversationId> conversationIds,
  bool processRightAway,
  StringList? categories,
  bool enableAlwaysDelete,
  FolderId? destinationFolderId,
  ServiceErrorHandling errorHandlingMode,
) {
  EwsUtilities.Assert(
    actionType == ConversationActionType.AlwaysCategorize ||
        actionType == ConversationActionType.AlwaysMove ||
        actionType == ConversationActionType.AlwaysDelete,
    "ApplyConversationAction",
    "Invalid actionType",
  );

  EwsUtilities.ValidateParam(conversationIds, "conversationId");
  EwsUtilities.ValidateMethodVersion(
    this,
    ExchangeVersion.Exchange2010_SP1,
    "ApplyConversationAction",
  );

  ApplyConversationActionRequest request = ApplyConversationActionRequest(
    this,
    errorHandlingMode,
  );

  for (final conversationId in conversationIds) {
    ConversationAction action = ConversationAction();

    action.Action = actionType;
    action.ConversationId = conversationId;
    action.ProcessRightAway = processRightAway;
    action.Categories = categories;
    action.EnableAlwaysDelete = enableAlwaysDelete;
    action.DestinationFolderId = destinationFolderId != null
        ? FolderIdWrapper(destinationFolderId)
        : null;

    request.ConversationActions.add(action);
  }

  return request.Execute();
}