Method CreateFolderBeneathAsync
- Namespace
- MailFathom.Application.Folders
- Assembly
- MailFathom.Application.dll
CreateFolderBeneathAsync(MailAccountId, MailFolderAlias, RemoteFolderPath?, string, MailFolderSpecialUse?, MailTransportSecurityPolicy, CancellationToken)
Creates one folder a person named, beneath a folder they chose or at the top of their own namespace.
Task<RemoteFolderPath> CreateFolderBeneathAsync(MailAccountId accountId, MailFolderAlias folderAlias, RemoteFolderPath? parentPath, string name, MailFolderSpecialUse? role, MailTransportSecurityPolicy transportSecurityPolicy, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account whose mailbox gains the folder.
folderAliasMailFolderAliasThe alias the folder is to be declared under, which is the name every failure reports.
parentPathRemoteFolderPath?The folder to create it beneath, or null for the top of the account's personal namespace.
namestringThe folder's own name, which is one level and never a path.
roleMailFolderSpecialUse?The role the folder is to play, or null for an ordinary folder.
transportSecurityPolicyMailTransportSecurityPolicyThe connection and authentication policy the implementation must obey.
cancellationTokenCancellationTokenCancels waiting for the account's write connection, connecting, authenticating, and creating.
Returns
- Task<RemoteFolderPath>
The created folder as the server advertises it, with the hierarchy delimiter the server reported.
Remarks
It differs from the method above in who composed the path, which is why it is a second method rather than the same one called differently. There, the whole path is text an operator wrote and is used exactly as written; here, a person named one level and the path is composed against the account's own personal namespace and the delimiter the server reports, because neither is something a client could know. Nothing above this port ever builds a remote path out of a name somebody typed.
A role is carried to the server with RFC 6154's CREATE ... (USE (\Junk)) where the server advertises
CREATE-SPECIAL-USE, and left off where it does not — the folder is still created, at the role's standard
English name, and MailFathom records the role in its own declaration either way. A server that refuses the
attribute refuses the creation, which is what RFC 6154 requires of it and is reported as a refusal rather than
retried without the attribute: a folder created without the role somebody asked for is not the folder they asked
for.
Exceptions
- ArgumentNullException
Thrown when
transportSecurityPolicyis null.- RemoteFolderCreationRefusedException
Thrown when the mail server answered and refused to hold a folder there.
- MailboxUnavailableException
Thrown when the mail server did not serve the creation within its configured resilience budget.