GetCapabilities Method


Returns the list of capabilities of the IMAP4 server.

 

You can additionally specify Capability parameter if you're looking for the particular capability. Capability names are case-insensitive.

This method does not necessarily send CAPABILITY command to the server because the capabilities list may already be available (for instance, you already called this method before or the server itself isssues CAPABILITY response during connecting or authenticating the client).


arrCaps = ObjectName.GetCapabilities([AlwaysSendCommand], [Capability])  
Parameters:  
AlwaysSendCommand As Boolean (optional) If True, MailBee will send CAPABILITY command even if the capabilities list has already been received from the server. The default and recommended value is False  
Capability As String (optional) If non-empty, tells MailBee to return only the specified capability (or return empty array if the specified capability is not supported by the server). If empty string (default), MailBee will return all the capabilities supported by the server  
Return value As Variant Array of Variant/Long, each value is a capability name. If error has occurred, return value is Empty  

Usage example:

' This sample checks if the server supports XLIST extension (Sent/Drafts/Trash/Spam flags for IMAP folders,
' Gmail is well-known service which supports this) and uses XLIST to get folders with these flags.
' If XLIST is not supported, folders are retrieved without special folder flags.
Dim Mailer, Caps, Message, UseXList
'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"
Mailer.SSL.Enabled = True
If Mailer.Connect("imap.gmail.com", 993, "username", "password") Then
  Caps = Mailer.GetCapabilities( , "XLIST")
  If Not IsEmpty(Caps) Then
    UseXList = False
    If UBound(Caps) >= Lbound(Caps) Then UseXList = True
    Set Mailboxes = Mailer.RetrieveMailboxesEx(, , , UseXList)
    Mailer.Disconnect
  End If
End If

See Also:

RetrieveMailboxesEx Method


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