Click or drag to resize
MimeKit

AccessControlList Class

An Access Control List (ACL)
Inheritance Hierarchy
SystemObject
  System.Collections.GenericListAccessControl
    MailKitAccessControlList

Namespace:  MailKit
Assembly:  MailKit (in MailKit.dll) Version: 3.0.0
Syntax
C#
public class AccessControlList : List<AccessControl>

The AccessControlList type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyCapacity
Gets or sets the total number of elements the internal data structure can hold without resizing.
(Inherited from ListAccessControl.)
Public propertyCount (Inherited from ListAccessControl.)
Public propertyItem
Gets or sets the element at the specified index.
(Inherited from ListAccessControl.)
Top
Methods
  NameDescription
Public methodAdd (Inherited from ListAccessControl.)
Public methodAddRange (Inherited from ListAccessControl.)
Public methodAsReadOnly (Inherited from ListAccessControl.)
Public methodBinarySearch(T)
Searches the entire sorted ListT for an element using the default comparer and returns the zero-based index of the element.
(Inherited from ListAccessControl.)
Public methodBinarySearch(T, IComparerT)
Searches the entire sorted ListT for an element using the specified comparer and returns the zero-based index of the element.
(Inherited from ListAccessControl.)
Public methodBinarySearch(Int32, Int32, T, IComparerT)
Searches a range of elements in the sorted ListT for an element using the specified comparer and returns the zero-based index of the element.
(Inherited from ListAccessControl.)
Public methodClear (Inherited from ListAccessControl.)
Public methodContains (Inherited from ListAccessControl.)
Public methodConvertAllTOutput (Inherited from ListAccessControl.)
Public methodCopyTo(T) (Inherited from ListAccessControl.)
Public methodCopyTo(T, Int32) (Inherited from ListAccessControl.)
Public methodCopyTo(Int32, T, Int32, Int32)
Copies a range of elements from the ListT to a compatible one-dimensional array, starting at the specified index of the target array.
(Inherited from ListAccessControl.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExists (Inherited from ListAccessControl.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFind
Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire ListT.
(Inherited from ListAccessControl.)
Public methodFindAll
Retrieves all the elements that match the conditions defined by the specified predicate.
(Inherited from ListAccessControl.)
Public methodFindIndex(PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire ListT.
(Inherited from ListAccessControl.)
Public methodFindIndex(Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the ListT that extends from the specified index to the last element.
(Inherited from ListAccessControl.)
Public methodFindIndex(Int32, Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the ListT that starts at the specified index and contains the specified number of elements.
(Inherited from ListAccessControl.)
Public methodFindLast
Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire ListT.
(Inherited from ListAccessControl.)
Public methodFindLastIndex(PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire ListT.
(Inherited from ListAccessControl.)
Public methodFindLastIndex(Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the ListT that extends from the first element to the specified index.
(Inherited from ListAccessControl.)
Public methodFindLastIndex(Int32, Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the ListT that contains the specified number of elements and ends at the specified index.
(Inherited from ListAccessControl.)
Public methodForEach (Inherited from ListAccessControl.)
Public methodGetEnumerator (Inherited from ListAccessControl.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetRange (Inherited from ListAccessControl.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf(T) (Inherited from ListAccessControl.)
Public methodIndexOf(T, Int32)
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ListT that extends from the specified index to the last element.
(Inherited from ListAccessControl.)
Public methodIndexOf(T, Int32, Int32)
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ListT that starts at the specified index and contains the specified number of elements.
(Inherited from ListAccessControl.)
Public methodInsert (Inherited from ListAccessControl.)
Public methodInsertRange (Inherited from ListAccessControl.)
Public methodLastIndexOf(T) (Inherited from ListAccessControl.)
Public methodLastIndexOf(T, Int32)
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the ListT that extends from the first element to the specified index.
(Inherited from ListAccessControl.)
Public methodLastIndexOf(T, Int32, Int32)
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the ListT that contains the specified number of elements and ends at the specified index.
(Inherited from ListAccessControl.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove (Inherited from ListAccessControl.)
Public methodRemoveAll
Removes all the elements that match the conditions defined by the specified predicate.
(Inherited from ListAccessControl.)
Public methodRemoveAt (Inherited from ListAccessControl.)
Public methodRemoveRange (Inherited from ListAccessControl.)
Public methodReverse (Inherited from ListAccessControl.)
Public methodReverse(Int32, Int32)
Reverses the order of the elements in the specified range.
(Inherited from ListAccessControl.)
Public methodSort (Inherited from ListAccessControl.)
Public methodSort(ComparisonT) (Inherited from ListAccessControl.)
Public methodSort(IComparerT) (Inherited from ListAccessControl.)
Public methodSort(Int32, Int32, IComparerT) (Inherited from ListAccessControl.)
Public methodToArray (Inherited from ListAccessControl.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTrimExcess (Inherited from ListAccessControl.)
Public methodTrueForAll (Inherited from ListAccessControl.)
Top
Remarks
An Access Control List (ACL) is a list of access controls defining the permissions various identities have available.
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