IMail FolderOpen Async(Folder Access, UInt 32, UInt 64, IListUnique Id, Cancellation Token) Method
Asynchronously opens the folder using the requested folder access.
Definition
Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
The FolderAccess state of the folder.
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
Task<FolderAccess> OpenAsync(
FolderAccess access,
uint uidValidity,
ulong highestModSeq,
IList<UniqueId> uids,
CancellationToken cancellationToken = default
)Parameters
- access FolderAccess
- The requested folder access.
- uidValidity UInt32
- The last known UidValidity value.
- highestModSeq UInt64
- The last known HighestModSeq value.
- uids IListUniqueId
- The last known list of unique message identifiers.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskFolderAccessThe FolderAccess state of the folder.
Remarks
This variant of the OpenAsync(FolderAccess, CancellationToken) method is meant for quick resynchronization of the folder. Before calling this method, the Enable(ImapFeatures, CancellationToken) method MUST be called.
You should also make sure to add listeners to the MessagesVanished and MessageFlagsChanged events to get notifications of changes since the last time the folder was opened.
Exceptions
| ArgumentOutOfRangeException | access is not a valid value. |
| ObjectDisposedException | The IMailStore has been disposed. |
| ServiceNotConnectedException | The IMailStore is not connected. |
| ServiceNotAuthenticatedException | The IMailStore is not authenticated. |
| FolderNotFoundException | The MailFolder does not exist. |
| InvalidOperationException | The quick resynchronization feature has not been enabled. |
| NotSupportedException | The mail store does not support the quick resynchronization feature. |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| IOException | An I/O error occurred. |
| ProtocolException | The server's response contained unexpected tokens. |
| CommandException | The command failed. |