Retrieves status information (total number of messages, various attributes as well as quota
information) for the specified mailbox.
Namespace: S22.ImapAssembly: S22.Imap (in S22.Imap.dll) Version: 3.6.0.0 (3.6.0.0)
Syntax
C# |
---|
MailboxInfo GetMailboxInfo( string mailbox = null ) |
Parameters
- mailbox (Optional)
- Type: System..::..String
The mailbox to retrieve status information for. If this parameter is omitted, the value of the DefaultMailbox property is used to determine the mailbox to operate on.
Return Value
A MailboxInfo object containing status information for the mailbox.
Remarks
Not all IMAP servers support the retrieval of quota information. If it is not
possible to retrieve this information, the UsedStorage and FreeStorage properties of the
returned MailboxStatus instance are set to 0.
Examples

ImapClient Client = new ImapClient("imap.gmail.com", 993, "My_UsernamMe", "My_Password", true, AuthMethod.Login); // Get a list of all mailboxes. foreach(string m in Client.ListMailboxes()) { MailboxInfo info = Client.GetMailboxInfo(m); Console.WriteLine(info.Name); Console.WriteLine("Used storage: " + info.UsedStorage); Console.WriteLine("Free storage: " + info.FreeStorage); Console.WriteLine("Next UID: " + info.NextUID); Console.WriteLine("Messages: " + info.Messages); Console.WriteLine("Unread: " + info.Unread); Console.WriteLine("Set Flags: "); foreach (MailboxFlag f in info.Flags) Console.Write(f.ToString() + ","); Console.WriteLine(); } Client.Dispose();
Exceptions
Exception | Condition |
---|---|
S22.Imap..::..BadServerResponseException | The operation could not be completed because the server returned an error. The message property of the exception contains the error message returned by the server. |
System..::..ObjectDisposedException | The ImapClient object has been disposed. |
System.IO..::..IOException | There was a failure writing to or reading from the network. |
S22.Imap..::..NotAuthenticatedException | The method was called in non-authenticated state, i.e. before logging in. |