ImapGetFolderQuota Method
Gets the quota (resource usage limit) of the specified folder.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public FolderQuota GetFolderQuota(
	string folderName
)

Parameters

folderName
Type: SystemString
The full name of the folder to get the quota of.

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 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 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.
Examples
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).
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();
    }
}
See Also