Table of Contents

Method RenameFolderAsync

Namespace
MailFathom.Application.Folders
Assembly
MailFathom.Application.dll

RenameFolderAsync(MailAccountId, MailFolderAlias, RemoteFolderPath, RemoteFolderPath?, string, MailTransportSecurityPolicy, CancellationToken)

Renames a folder, which is also how it is moved to another place in the hierarchy.

Task<RemoteFolderPath> RenameFolderAsync(MailAccountId accountId, MailFolderAlias folderAlias, RemoteFolderPath currentPath, RemoteFolderPath? newParentPath, string newName, MailTransportSecurityPolicy transportSecurityPolicy, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account whose mailbox holds the folder.

folderAlias MailFolderAlias

The folder alias the path is declared under, which is the name every failure reports.

currentPath RemoteFolderPath

The path the folder is at now.

newParentPath RemoteFolderPath?

The folder it is to sit beneath, or null for the top of the account's personal namespace.

newName string

The name it is to carry, which is one level and never a path.

transportSecurityPolicy MailTransportSecurityPolicy

The connection and authentication policy the implementation must obey.

cancellationToken CancellationToken

Cancels waiting for the account's write connection, connecting, authenticating, and renaming.

Returns

Task<RemoteFolderPath>

The folder's new path as the server advertises it, with the hierarchy delimiter the server reported.

Remarks

A move and a rename are one command: IMAP's RENAME takes a destination parent and a name, so keeping the name and changing the parent moves the folder with everything beneath it, and keeping the parent and changing the name renames it. The caller states both and this issues one command, rather than either side deciding which of the two was meant.

The parent and the name are stated separately rather than as a composed path for the reason a creation states them separately: the hierarchy delimiter and the account's personal namespace are the server's, so nothing above this port ever builds a remote path out of a name somebody typed.

Exceptions

ArgumentNullException

Thrown when transportSecurityPolicy is null.

RemoteFolderEditRefusedException

Thrown when the mail server answered and refused to rename the folder.

MailboxUnavailableException

Thrown when the mail server did not serve the rename within its configured resilience budget.