Method OpenForFoldersAsync
- Namespace
- MailFathom.Application.Synchronization.Sessions
- Assembly
- MailFathom.Application.dll
OpenForFoldersAsync(MailAccountId, IReadOnlyList<MailFolderResolution>, MailTransportSecurityPolicy, CancellationToken)
Opens one session that watches several folders, or reports that the server cannot serve one.
Task<MailboxFolderSetNotificationSessionResult> OpenForFoldersAsync(MailAccountId accountId, IReadOnlyList<MailFolderResolution> folders, MailTransportSecurityPolicy transportSecurityPolicy, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe local account identifier.
foldersIReadOnlyList<MailFolderResolution>The alias bindings to watch, in the order they are subscribed and led by the one the session selects.
transportSecurityPolicyMailTransportSecurityPolicyThe connection and authentication policy the implementation must obey.
cancellationTokenCancellationTokenCancels connecting, authenticating, selecting, and subscribing.
Returns
- Task<MailboxFolderSetNotificationSessionResult>
An open session watching every supplied folder, or the statement that the server advertises no mechanism for watching more than one.
Remarks
The caller decides how many folders to ask for, because the bound is an operator's answer about a server rather than something an adapter can discover: a subscription naming more mailboxes than the server will accept is refused as a whole, and the folders left out are polled instead of being dropped.
A server that advertises no such mechanism is an ordinary answer rather than a failure, and the caller falls back to whatever it does for one folder at a time. It is reported for the same reason the single-folder result is: an operator who configured push needs to see which mechanism the server actually agreed to.
Exceptions
- ArgumentNullException
Thrown when
foldersis null.- ArgumentException
Thrown when
foldersis empty.- MailboxUnavailableException
Thrown when the mail server did not accept the session within its configured resilience budget.