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
accountIdMailAccountIdThe account whose mailbox holds the folder.
folderAliasMailFolderAliasThe folder alias the path is declared under, which is the name every failure reports.
currentPathRemoteFolderPathThe path the folder is at now.
newParentPathRemoteFolderPath?The folder it is to sit beneath, or null for the top of the account's personal namespace.
newNamestringThe name it is to carry, which is one level and never a path.
transportSecurityPolicyMailTransportSecurityPolicyThe connection and authentication policy the implementation must obey.
cancellationTokenCancellationTokenCancels 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
transportSecurityPolicyis 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.