ImapSelectFolder Method
Selects the specified folder (mailbox in IMAP4 terms) for read-write access.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public bool SelectFolder(
	string folderName
)

Parameters

folderName
Type: SystemString
The full name of the folder to be selected.

Return Value

Type: Boolean
true if the folder was selected successfully; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

To select the folder for read-only access, the developer should use ExamineFolder(String) method.

The developer should specify the full name of the folder (including all parent folders' names if the folder is subfolder of another existing folder). See CreateFolder(String) topic for details regarding folder names.

Examples
This sample connects to the IMAP4 server, logs in the mail account, selects Inbox folder, and marks all messages as seen (read).
using System;
using MailBee;
using MailBee.ImapMail;

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

         // Connect to the server and log in the account.
         imp.Connect("imap.company.com");
         imp.Login("jdoe", "secret");

         // Select the folder.
         imp.SelectFolder("Inbox");

         imp.SetMessageFlags(Imap.AllMessages, false,
             SystemMessageFlags.Seen, MessageFlagAction.Add);

         imp.Disconnect();
     }
}
See Also