Gets the quota (resource usage limit) of the specified folder.
FolderQuota object if the quota information was downloaded successfully; otherwise, a null reference (Nothing in Visual Basic).
This method can be used to obtain the folder quota information such as maximum allowed size of the folder, the current size of the folder, etc.
To get the quota set for the entire account on the IMAP4 server, the developer can use GetAccountQuota method.
Note This method uses QUOTA capability be supported by the IMAP4 server. The developer can check if QUOTA capability is supported using GetExtension method.
| Exception Type | Condition |
|---|---|
| MailBeeProtocolExtensionNotSupportedException | QUOTA not supported by the server and ThrowExceptions is true. |
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample gets Inbox folder quota information and displays the maximum allowed size of the folder (the top limit of the total size in bytes of all messages in the folder).
[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("mail.company.com"); imp.Login("jdoe@company.com", "secret"); if (imp.GetExtension("QUOTA") != null) { // Download Inbox folder quota information. FolderQuota quota = imp.GetFolderQuota("Inbox"); if (quota.MaxStorageSize > -1) { Console.WriteLine(quota.MaxStorageSize + " is the maximum allowed total size (in bytes) " + "of all messages in the folder."); } } else { Console.WriteLine("QUOTA capability not supported, sorry"); } imp.Disconnect(); } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.ImapMail Module Sample Sub Main(ByVal args As String()) 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") If Not imp.GetExtension("QUOTA") Is Nothing Then ' Download Inbox folder status information. Dim quota As FolderQuota = imp.GetFolderQuota("Inbox") If quota.MaxStorageSize > -1 Then Console.WriteLine(quota.MaxStorageSize & _ " is the maximum allowed total size (in bytes) " & _ "of all messages in the folder.") End If Else Console.WriteLine("QUOTA capability not supported, sorry") End If imp.Disconnect() End Sub End Module
Imap Class | MailBee.ImapMail Namespace | GetAccountQuota