Click or drag to resize
MimeKit

IMailFolderExtensionsReplaceAsync(IMailFolder, FormatOptions, UniqueId, MimeMessage, MessageFlags, CancellationToken, ITransferProgress) Method

Asynchronously replace a message in the folder.

Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public static Task<UniqueId?> ReplaceAsync(
	this IMailFolder folder,
	FormatOptions options,
	UniqueId uid,
	MimeMessage message,
	MessageFlags flags = MessageFlags.None,
	CancellationToken cancellationToken = default,
	ITransferProgress progress = null
)

Parameters

folder  IMailFolder
The folder.
options  FormatOptions
The formatting options.
uid  UniqueId
The UID of the message to be replaced.
message  MimeMessage
The message.
flags  MessageFlags  (Optional)
The message flags.
cancellationToken  CancellationToken  (Optional)
The cancellation token.
progress  ITransferProgress  (Optional)
The progress reporting mechanism.

Return Value

TaskNullableUniqueId
The UID of the new message, if available; otherwise, null.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IMailFolder. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullException

options is null.

-or-

message is null.

ArgumentExceptionuid is invalid.
ObjectDisposedException The IMailStore has been disposed.
ServiceNotConnectedException The IMailStore is not connected.
ServiceNotAuthenticatedException The IMailStore is not authenticated.
InvalidOperationException Internationalized formatting was requested but has not been enabled.
FolderNotFoundException The MailFolder does not exist.
FolderNotOpenException The MailFolder is not currently open in read-write mode.
OperationCanceledException The operation was canceled via the cancellation token.
NotSupportedException

Internationalized formatting was requested but is not supported by the server.

IOException An I/O error occurred.
ProtocolException The server's response contained unexpected tokens.
CommandException The server replied with a NO or BAD response.
Remarks
Replaces the specified message in the folder and returns the UniqueId assigned to the new message.
See Also