Click or drag to resize
MimeKit

ImapCapabilities Enumeration

Capabilities supported by an IMAP server.

Namespace:  MailKit.Net.Imap
Assembly:  MailKit (in MailKit.dll) Version: 2.10.0
Syntax
C#
[FlagsAttribute]
public enum ImapCapabilities
Members
  Member nameValueDescription
None0 The server does not support any additional extensions.
IMAP41 The server implements the core IMAP4 commands.
IMAP4rev12 The server implements the core IMAP4rev1 commands.
IMAP4rev24 The server implements the core IMAP4rev2 commands.
Status8 The server supports the STATUS command.
Acl16 The server supports the ACL extension defined in rfc2086 and rfc4314.
Quota32 The server supports the QUOTA extension.
LiteralPlus64 The server supports the LITERAL+ extension.
Idle128 The server supports the IDLE extension.
MailboxReferrals256 The server supports the MAILBOX-REFERRALS extension.
LoginReferrals512 the server supports the LOGIN-REFERRALS extension.
Namespace1024 The server supports the NAMESPACE extension.
Id2048 The server supports the ID extension.
Children4096 The server supports the CHILDREN extension.
LoginDisabled8192 The server supports the LOGINDISABLED extension.
StartTLS16384 The server supports the STARTTLS extension.
MultiAppend32768 The server supports the MULTIAPPEND extension.
Binary65536 The server supports the BINARY content extension.
Unselect131072 The server supports the UNSELECT extension.
UidPlus262144 The server supports the UIDPLUS extension.
Catenate524288 The server supports the CATENATE extension.
CondStore1048576 The server supports the CONDSTORE extension.
ESearch2097152 The server supports the ESEARCH extension.
SaslIR4194304 The server supports the SASL-IR extension.
Compress8388608 The server supports the COMPRESS extension.
Within16777216 The server supports the WITHIN extension.
Enable33554432 The server supports the ENABLE extension.
QuickResync67108864 The server supports the QRESYNC extension.
SearchResults134217728 The server supports the SEARCHRES extension.
Sort268435456 The server supports the SORT extension.
Thread536870912 The server supports the THREAD extension.
Annotate1073741824 The server supports the ANNOTATE extension.
ListExtended2147483648 The server supports the LIST-EXTENDED extension.
Convert4294967296 The server supports the CONVERT extension.
Language8589934592 The server supports the LANGUAGE extension.
I18NLevel17179869184 The server supports the I18NLEVEL extension.
ESort34359738368 The server supports the ESORT extension.
Context68719476736 The server supports the CONTEXT extension.
Metadata137438953472 The server supports the METADATA extension.
MetadataServer274877906944 The server supports the METADATA-SERVER extension.
Notify549755813888 The server supports the NOTIFY extension.
Filters1099511627776 The server supports the FILTERS extension.
ListStatus2199023255552 The server supports the LIST-STATUS extension.
SortDisplay4398046511104 The server supports the SORT=DISPLAY extension.
CreateSpecialUse8796093022208 The server supports the CREATE-SPECIAL-USE extension.
SpecialUse17592186044416 The server supports the SPECIAL-USE extension.
FuzzySearch35184372088832 The server supports the SEARCH=FUZZY extension.
MultiSearch70368744177664 The server supports the MULTISEARCH extension.
Move140737488355328 The server supports the MOVE extension.
UTF8Accept281474976710656 The server supports the UTF8=ACCEPT extension.
UTF8Only562949953421312 The server supports the UTF8=ONLY extension.
LiteralMinus1125899906842624 The server supports the LITERAL- extension.
AppendLimit2251799813685248 The server supports the APPENDLIMIT extension.
Unauthenticate4503599627370496 The server supports the UNAUTHENTICATE extension.
StatusSize9007199254740992 The server supports the STATUS=SIZE extension.
ListMyRights18014398509481984 The server supports the LIST-MYRIGHTS extension.
ObjectID36028797018963968 The server supports the OBJECTID extension.
Replace72057594037927936 The server supports the REPLACE extension.
SaveDate144115188075855872 The server supports the SAVEDATE extension.
XList1152921504606846976 The server supports the XLIST extension (GMail).
GMailExt12305843009213693952 The server supports the X-GM-EXT1 extension (GMail).
Remarks
Capabilities are read as part of the response to the CAPABILITY command that is issued during the connection and authentication phases of the ImapClient.
Examples
C#
public static void Capabilities ()
{
    using (var client = new ImapClient ()) {
        client.Connect ("imap.gmail.com", 993, SecureSocketOptions.SslOnConnect);

        var mechanisms = string.Join (", ", client.AuthenticationMechanisms);
        Console.WriteLine ("The IMAP server supports the following SASL authentication mechanisms: {0}", mechanisms);

        client.Authenticate ("username", "password");

        if (client.Capabilities.HasFlag (ImapCapabilities.Id)) {
            var clientImplementation = new ImapImplementation { Name = "MailKit", Version = "1.0" };
            var serverImplementation = client.Identify (clientImplementation);

            Console.WriteLine ("Server implementation details:");
            foreach (var property in serverImplementation.Properties)
                Console.WriteLine ("  {0} = {1}", property.Key, property.Value);
        }

        if (client.Capabilities.HasFlag (ImapCapabilities.Acl)) {
            Console.WriteLine ("The IMAP server supports Access Control Lists.");

            Console.WriteLine ("The IMAP server supports the following access rights: {0}", client.Rights);

            Console.WriteLine ("The Inbox has the following access controls:");
            var acl = client.Inbox.GetAccessControlList ();
            foreach (var ac in acl)
                Console.WriteLine ("  {0} = {1}", ac.Name, ac.Rights);

            var myRights = client.Inbox.GetMyAccessRights ();
            Console.WriteLine ("Your current rights for the Inbox folder are: {0}", myRights);
        }

        if (client.Capabilities.HasFlag (ImapCapabilities.Quota)) {
            Console.WriteLine ("The IMAP server supports quotas.");

            Console.WriteLine ("The current quota for the Inbox is:");
            var quota = client.Inbox.GetQuota ();

            if (quota.StorageLimit.HasValue && quota.StorageLimit.Value)
                Console.WriteLine ("  Limited by storage space. Using {0} out of {1} bytes.", quota.CurrentStorageSize.Value, quota.StorageLimit.Value);

            if (quota.MessageLimit.HasValue && quota.MessageLimit.Value)
                Console.WriteLine ("  Limited by the number of messages. Using {0} out of {1} bytes.", quota.CurrentMessageCount.Value, quota.MessageLimit.Value);

            Console.WriteLine ("The quota root is: {0}", quota.QuotaRoot);
        }

        if (client.Capabilities.HasFlag (ImapCapabilities.Thread)) {
            if (client.ThreadingAlgorithms.Contains (ThreadingAlgorithm.OrderedSubject))
                Console.WriteLine ("The IMAP server supports threading by subject.");
            if (client.ThreadingAlgorithms.Contains (ThreadingAlgorithm.References))
                Console.WriteLine ("The IMAP server supports threading by references.");
        }

        client.Disconnect (true);
    }
}
See Also