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

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool ExamineFolder(
	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

When the folder is selected for read-only access, the selected folder is identified as read-only. No changes to the permanent state of the folder, including per-user state, are permitted; in particular, when messages are downloaded, they won't lose the \Recent flag.

To select the folder for read-write access, the developer should use SelectFolder(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 in read-only mode, and downloads the last message without loosing \Recent flag (if the message has this flag set).
using System;
using MailBee;
using MailBee.ImapMail;
using MailBee.Mime;

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

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

        // Select the folder in read-only mode.
        imp.ExamineFolder("Inbox");

        if (imp.MessageCount > 0)
        {
            // Download and save last message into a file.
            // If the message is recent, it won't loose \Recent flag.
            MailMessage msg = imp.DownloadEntireMessage(imp.MessageCount, false);
            msg.SaveMessage(@"C:\Temp\msg.eml");
        }

        imp.Disconnect();
    }
}
See Also