ImapCopyMessages Method (String, Boolean, String)
Copies the specified messages from the currently selected folder to the specified folder.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool CopyMessages(
	string messageIndexSet,
	bool indexIsUid,
	string targetFolderName
)

Parameters

messageIndexSet
Type: SystemString
A message sequence string containing ordinal message numbers or UIDs. Can be composed manually or using ToString.
indexIsUid
Type: SystemBoolean
If true, messageIndexSet is treated as a sequence of UIDs; otherwise, as a sequence of ordinal message numbers.
targetFolderName
Type: SystemString
The full name of the destination folder.

Return Value

Type: Boolean
true if the messages were copied successfully; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks
To learn how to specify a valid message sequence (messageIndexSet value), see DownloadEnvelopes(String, Boolean) topic.
Examples

This sample copies all messages from the inbox folder to the Sent folder.

The sample assumes "Sent" folder had already been created in the past. To learn how to make sure the folder exists, see UploadMessage(MailMessage, String, String, DateTime) or UploadMessage(MailMessage, String, String, String) samples.

using System;
using MailBee;
using MailBee.ImapMail;

class Sample
{
    static void Main(string[] args)
    {
        Imap imp = new Imap();

        // Connect to the server, login and select inbox.
        imp.Connect("imap.company.com");
        imp.Login("jdoe@company.com", "secret");
        imp.SelectFolder("INBOX");

        // Copy all messages in Inbox into Sent.
        imp.CopyMessages(Imap.AllMessages, false, "Sent");

        // Disconnect from the server.
        imp.Disconnect();
    }
}
See Also