Delen via


MSMQQueueInfo.PrivLevel

 

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 PrivLevel property of the MSMQQueueInfo object specifies whether the queue accepts private (encrypted) messages, non-private messages, or both.

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

Property Value

You can set PrivLevel to any 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 does not correspond to the privacy level of the queue, the message is rejected by the queue, and, if the sending application requested a negative acknowledgment message when it sent the message, MQMSG_CLASS_BAD_ENCRYPTION is returned to the sending application to indicate the message was rejected.

To specify the privacy level when creating the queue, set the PathName property and the PrivLevel property, and then call the MSMQQueueInfo.Create method.

To reset or retrieve the privacy 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 refer to 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 privacy level of an existing queue, set PrivLevel 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 local computer.

To retrieve the stored privacy level of a queue, call the MSMQQueueInfo.Refresh method and inspect the PrivLevel property.

Private messages can be encrypted in two ways.

Equivalent API Function Property

With function calls, the equivalent property is PROPID_Q_PRIV_LEVEL.

Example Code

The following examples are included in Using Message Queuing.

For an example of See
Requesting encryption when sending messages Visual Basic Code Example: Requesting Encryption
Creating a queue that accepts only private messages Visual Basic Code Example: Enforcing Encryption
Setting and retrieving the privacy level of an existing queue Visual Basic Code Example: Setting MSMQQueueInfo.PrivLevel

 Visual Basic Code Example: Retrieving MSMQQueueInfo.PrivLevel

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

MSMQQueueInfo
MSMQQueueInfo.Create
MSMQQueueInfo.Refresh
MSMQQueueInfo.Update
PROPID_Q_PRIV_LEVEL