GetMailboxQuota Method


Retrieves the size of the specified mailbox quota in kilobytes.

To get the quota for the entire mail account (including all mailboxes in it), specify empty value for the MailboxName. The method will return -1 if the server does not support QUOTA extension or the folder name is incorrect. Otherwise, the returned value is the quota size in kilobytes (1 kilobyte is 1024 bytes).

Upon calling this method, you can check QuotaUsage property to determine the used space in the account.

If the quota value is very large (such as 2147483647), it usually means the quota size is not limited for the given account (the quota is not set).


lngQuota = ObjectName.GetMailboxQuota(MailboxName)  
Parameters:  
MailboxName As String Name of the mailbox to get the quota for, or an empty string to get the quota for the entire account  
Return value As Long On success, the quota value in kilobytes. On failure, return value is -1  
Remarks: QUOTA extension may not be supported by some IMAP servers.

Usage example:

' This sample displays the quota limit (in kilobytes) for the mail account
Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\Temp\imap4_log.txt"
Mailer.ClearLog
Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
  MsgBox Mailer.GetMailboxQuota("") & " kilobytes"
  Mailer.Disconnect
End If

See Also:

QuotaUsage Property


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.