Gets the status of the specified folder without selecting it.
FolderStatus object if the status information was downloaded successfully; otherwise, a null reference (Nothing in Visual Basic).
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.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
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
Imap Class | MailBee.ImapMail Namespace