Delen via


MSMQQueueInfo.Authenticate

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

Optional. The Authenticate property of the MSMQQueueInfo object specifies whether the queue only accepts authenticated messages.

Data type: Long
Run-time access: Read/write
Property Authenticate As Long  

Property Value

You can set Authenticate to one of the following values:

MQ_AUTHENTICATE_NONE

The default. The queue accepts authenticated and non-authenticated messages.

MQ_AUTHENTICATE

The queue only accepts authenticated messages.

Remarks

This property sets the authentication level of the queue. For information on how Message Queuing authenticates messages, see Message Authentication.

When a non-authenticated messages is sent to a queue that only accepts authenticated messages, the message is rejected. If the sending application has also requested negative acknowledgment messages, a negative acknowledgment message with the message class MQMSG_CLASS_BAD_SIGNATURE is returned to the sending application to indicate the message was rejected.

To specify the authentication level when creating a queue, set the MSMQQueueInfo.PathName property and the Authenticate property, and then call the MSMQQueueInfo.Create method.

To reset or retrieve the authentication level of an existing queue, your application must first obtain an MSMQQueueInfo object that represents the queue. This object can be returned by a query using the MSMQQuery.LookupQueue method or created by the sending or receiving application.

Before using an application-created MSMQQueueInfo object, the application must initialize it to reference the queue by setting its MSMQQueueInfo.PathName or MSMQQueueInfo.FormatName property. For public queues, setting the FormatName property with a cached public format name instead of the PathName property frees Message Queuing from the need to retrieve information stored in the directory service to generate this format name. Direct format names can be used only for local private queues.

To reset the authentication level of an existing queue, set the Authenticate property to a new level and call the MSMQQueueInfo.Update method. This method updates the queue information stored by Message Queuing. For public queues, this information is stored in the directory service. For private queues, this information is stored on the computer where the messages of the queue are stored.

To retrieve the stored authentication level of a queue, call the MSMQQueueInfo.Refresh method and inspect the Authenticate property. The property values of the MSMQQueueInfo object are not updated with the values stored by Message Queuing until the MSMQQueueInfo.Refresh method is called.

The sending application requests authentication by setting the MSMQMessage.AuthLevel message property when the message is sent.

To verify that the sending application requested authentication, peek at the MSMQMessage.IsAuthenticated2 property of the message.

Equivalent API Function Property

With function calls, the equivalent property is PROPID_Q_AUTHENTICATE.

Example Code

The following examples are included in Using Message Queuing.

For an example of See
Setting the authentication level when creating a queue Visual Basic Code Example: Enforcing Authentication
Setting and retrieving the authentication level of an existing queue Visual Basic Code Example: Setting MSMQQueueInfo.Authenticate

 Visual Basic Code Example: Retrieving MSMQQueueInfo.Authenticate

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

MSMQMessage.AuthLevel
MSMQMessage.IsAuthenticated2
MSMQQueueInfo
MSMQQueueInfo.Create
MSMQQueueInfo.Refresh
MSMQQueueInfo.Update
PROPID_Q_AUTHENTICATE