IImap FolderSort Async(String, Cancellation Token) Method
Asynchronously sort messages matching the specified query.
Definition
Namespace: MailKit.Net.Imap
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
An array of matching UIDs.
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
Task<SearchResults> SortAsync(
string query,
CancellationToken cancellationToken = default
)Parameters
- query String
- The search query.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskSearchResultsAn array of matching UIDs.
Remarks
Sends a UID SORT command with the specified query passed directly to the IMAP server
with no interpretation by MailKit. This means that the query may contain any arguments that a
UID SORT command is allowed to have according to the IMAP specifications and any
extensions that are supported, including RETURN parameters.
Exceptions
| ArgumentNullException | query is . |
| ArgumentException | query is an empty string. |
| NotSupportedException | The IMAP server does not support the SORT extension. |
| ObjectDisposedException | The ImapClient has been disposed. |
| ServiceNotConnectedException | The ImapClient is not connected. |
| ServiceNotAuthenticatedException | The ImapClient is not authenticated. |
| FolderNotOpenException | The ImapFolder is not currently open. |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| IOException | An I/O error occurred. |
| ImapProtocolException | The server's response contained unexpected tokens. |
| ImapCommandException | The server replied with a NO or BAD response. |