ImapGetAccountQuota Method
Gets the quota (resource usage limit) of the entire mail account on the server.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public FolderQuota GetAccountQuota()

Return Value

Type: FolderQuota
FolderQuota object if the quota information was downloaded successfully; otherwise, a null reference (Nothing in Visual Basic).
Exceptions
ExceptionCondition
MailBeeProtocolExtensionNotSupportedExceptionQUOTA not supported by the server and ThrowExceptions is true.
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

This method can be used to obtain the account quota and current usage (in bytes). Also, the current and the maximum number of messages in the account can be set too. However, most servers limit account usage in bytes only. Number of messages is usually not limited and not counted.

Note Note
This method uses QUOTA capability be supported by the IMAP4 server. The developer can check if QUOTA capability is supported using GetExtension(String) method. Also, some servers cannot return an account quota but they can return it for INBOX folder (however, this in fact designates the quota for the entire account). If you got such a server, use GetFolderQuota("INBOX") instead of GetAccountQuota.
Examples
This sample gets the account quota information and displays the maximum size (in bytes) and the current usage (in percent) of the account storage.
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.company.com");
        imp.Login("jdoe", "secret");

        if (imp.GetExtension("QUOTA") != null)
        {
            // Download quota information for the entire account.
            FolderQuota quota = imp.GetAccountQuota();

            if (quota.MaxStorageSize > -1 && quota.CurrentStorageSize > -1)
            {
                long percent = (quota.CurrentStorageSize * 100) / quota.MaxStorageSize;
                Console.WriteLine("You are using " + percent.ToString() + "% of your " +
                    quota.MaxStorageSize + " space");
            }
        }
        else
        {
            Console.WriteLine("QUOTA capability not supported, sorry");
        }

        imp.Disconnect();
    }
}
See Also