MailBee.NET Objects 3.1

Imap.GetFolderStatus Method 

Gets the status of the specified folder without selecting it.

public FolderStatus GetFolderStatus(
   string folderName
);

Parameters

folderName
The full name of the folder to get the status information of.

Return Value

FolderStatus object if the status information was downloaded successfully; otherwise, a null reference (Nothing in Visual Basic).

Remarks

This method can be used to obtain the folder status information such as total count of messages, recent messages count, unseen messages count, etc without selecting the folder.

Exceptions

Exception Type Condition
MailBeeException An error occurred and ThrowExceptions is true.

Example

This sample gets Inbox status information and displays unseen messages count. No folder is selected.

[C#]
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.server.com");
            imp.Login("jdoe@server.com", "secret");

            // Download Inbox folder status information.
            FolderStatus status = imp.GetFolderStatus("Inbox");

            Console.WriteLine(status.UnseenCount + " unseen message(s) in inbox");

            imp.Disconnect();
        }
    }
}
[Visual Basic]
Imports System
Imports MailBee
Imports MailBee.ImapMail

Module Sample
    Sub Main()
        Dim imp As New Imap

        ' Connect to the server and log in the account.
        imp.Connect("imap4.company.com")
        imp.Login("jdoe@company.com", "secret")

        ' Download Inbox folder status information.
        Dim status As FolderStatus = imp.GetFolderStatus("Inbox")

        imp.Disconnect()
    End Sub
End Module

See Also

Imap Class | MailBee.ImapMail Namespace