MessageQueueAccessControlEntry Class


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Specifies access rights for a trustee (user, group, or computer) to perform Message Queuing tasks.

Namespace:   System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)


public ref class MessageQueueAccessControlEntry : AccessControlEntry

System_CAPS_pubmethodMessageQueueAccessControlEntry(Trustee^, MessageQueueAccessRights)

Initializes a new instance of the MessageQueueAccessControlEntry class, granting the specified Message Queuing access rights to the specified trustee.

System_CAPS_pubmethodMessageQueueAccessControlEntry(Trustee^, MessageQueueAccessRights, AccessControlEntryType)

Initializes a new instance of the MessageQueueAccessControlEntry class, with the specified trustee and Message Queuing access rights. The type of access (such as Allow or Deny) is defined by the entry type you pass in.


Gets or sets custom access rights.(Inherited from AccessControlEntry.)


Gets or sets a value that indicates how the access rights apply to the trustee.(Inherited from AccessControlEntry.)


Gets or sets a set of common access rights that map to both standard and object-specific access rights for reading, writing, and executing.(Inherited from AccessControlEntry.)


Gets or sets the set of Message Queuing-specific rights to apply to the trustee.


Gets or sets a set of standard access rights that correspond to operations common to most types of securable objects.(Inherited from AccessControlEntry.)


Gets or sets the user, group, domain, or alias to which you are assigning access rights.(Inherited from AccessControlEntry.)


Determines whether the specified object is equal to the current object.(Inherited from Object.)


Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)


Serves as the default hash function. (Inherited from Object.)


Gets the Type of the current instance.(Inherited from Object.)


Creates a shallow copy of the current Object.(Inherited from Object.)


Returns a string that represents the current object.(Inherited from Object.)

Use the MessageQueueAccessControlEntry class to specify rights to apply to a trustee. These rights include peeking, receiving, or sending messages; viewing or modifying queue properties or permissions; and deleting queues. The MessageQueue class's SetPermissions method provides overloads for passing an instance of this class directly into the method, or adding it to an instance of AccessControlList so that you can add rights for more than one trustee at a time. The new access right is appended to the end of the queue's discretionary access control list (DACL), which identifies the users and groups that can access the queue.

There are some exceptions to this generalization about where the new right is added and its effects. For more information, see System.Messaging.

An overload of the MessageQueueAccessControlEntry constructor allows you specify a AccessControlEntryType member to indicate whether to allow or deny rights to the trustee. The order in which rights are allowed or denied in the resource's DACL affects whether the trustee has the specified rights. For example, if rights have already been granted to the trustee and you later add an entry that denies them, the system finds the granted rights first, so the user is granted rights you might have intended they be denied. You can use two entry types to override this behavior: Set and Revoke. For more information about controlling the way in which access rights are determined, see the AccessControlEntryType enumeration topic.

The MessageQueueAccessControlEntry class is associated with security based on access control lists (ACLs), which you can use to give users access to the Message Queuing system itself. This is different from code access security, which is implemented through the MessageQueuePermission and related classes. Message Queuing code access security defines queue-specific operations or queue access that an application might require which is subject to security control; it does not represent a right for the application to perform these operations or receive access in and of itself. See the topic [<topic://cpconcodeaccesssecurity>] for more information about code access security.

To set message queue permissions for a trustee, create a new instance of the Trustee class and pass it into an overload of the M:System.Messaging.MessageQueueAccessControlEntry.#ctor constructor. Specify the message queue access rights either by passing an instance of MessageQueueAccessRights into the constructor or by setting the MessageQueueAccessRights property on an existing MessageQueueAccessControlEntry instance.

You can then pass the MessageQueueAccessControlEntry instance directly to the MessageQueue::SetPermissions method, or alternately add the entry to an instance of AccessControlList before calling SetPermissions.

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top