EmptyFolder method

Future<void> EmptyFolder(
  1. FolderId? folderId,
  2. DeleteMode deleteMode,
  3. bool deleteSubFolders
)
Empties a folder. Calling this method results in a call to EWS. The folder id. The delete mode. if set to empty folder should also delete sub folders.

Implementation

Future<void> EmptyFolder(
    FolderId? folderId, DeleteMode deleteMode, bool deleteSubFolders) {
  EwsUtilities.ValidateParam(folderId, "folderId");

  EmptyFolderRequest request =
      new EmptyFolderRequest(this, ServiceErrorHandling.ThrowOnError);

  request.FolderIds.AddFolderId(folderId);
  request.DeleteMode = deleteMode;
  request.DeleteSubFolders = deleteSubFolders;

  return request.Execute();
}