PROPID_Q_PRIV_LEVEL

Optional. The PROPID_Q_PRIV_LEVEL property specifies the privacy level that is required by the queue. The privacy level determines how the queue handles encrypted messages.

Type Indicator
VT_UI4
PROPVARIANT Field
ulVal
Property Values
This property can be set to one of the following values:
MQ_PRIV_LEVEL_NONE
The queue accepts only non-private (clear) messages.
MQ_PRIV_LEVEL_BODY
The queue accepts only private (encrypted) messages.
MQ_PRIV_LEVEL_OPTIONAL
The default. The queue does not force privacy. It accepts private (encrypted) messages and non-private (clear) messages.

Remarks

The application can set the privacy level of queues and messages. If the privacy level of the message (PROPID_M_PRIV_LEVEL) does not match the privacy level of the queue, the queue rejects the message. In addition, if the sending application requested a negative acknowledgment message when it sent the message, MQMSG_CLASS_BAD_ENCRYPTION will be returned to the sending application to indicate that the message was rejected.

To set the privacy level when creating the queue, specify PROPID_Q_PRIV_LEVEL in the MQQUEUEPROPS structure and call MQCreateQueue.

To change the privacy level of a queue, specify PROPID_Q_PRIV_LEVEL in the MQQUEUEPROPS structure and call MQSetQueueProperties. When changing the privacy level of the queue, the new setting affects only arriving messages; it does not affect messages already in the queue.

To retrieve the privacy level of a queue, specify PROPID_Q_PRIV_LEVEL in the MQQUEUEPROPS structure and call MQGetQueueProperties and examine its returned value.

The privacy level of a message is set by PROPID_M_PRIV_LEVEL. If a message is marked private, MSMQ encrypts the body of the message when the message is sent. For information on security issues, see MSMQ Security Services.

Example

This example shows how PROPID_Q_PRIV_LEVEL is specified in the MQQUEUEPROPS structure for both setting and retrieving the privacy level of the queue.

//To set the privacy level
aPropID[i] = PROPID_Q_PRIV_LEVEL;        // Property identifier
aVariant[i].vt = VT_UI4;                 // Type indicator
aVariant[i].ulVal = MQ_PRIV_LEVEL_BODY;  // Privacy level of queue
i++

//To retrieve the privacy level
aPropID[i] = PROPID_Q_PRIV_LEVEL;       // Property identifier
aVariant[i].vt = VT_UI4;                // Type indicator
i++ 
 
For complete examples of… See…
Creating a public or private queue Creating a Queue
Retrieving the privacy level of the queue Retrieving PROPID_Q_PRIV_LEVEL

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mq.h.
  Import Library: Use mqrt.lib.
  Unicode: Defined only as Unicode.

See Also

MQCreateQueue, MQGetQueueProperties, MQSetQueueProperties, PROPID_M_PRIV_LEVEL