Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This property specifies whether the queue accepts private (encrypted) messages, nonprivate messages, or both.

Syntax

HRESULT get_PrivLevel( 
  long* 
plPrivLevel 
);
HRESULT put_PrivLevel( 
  long 
lPrivLevel
);

Parameters

plPrivLevelor lPrivLevel

Specifies whether the queue accepts private messages, nonprivate messages, or both. The following table shows the possible values.

Value Description

MQ_PRIV_LEVEL_NONE

The queue accepts only nonprivate (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 nonprivate (clear) messages.

Return Value

The following table describes the common return values.

Value Description

S_OK

Success

E_INVALIDARG

One or more arguments are invalid

E_NOTIMPL

The function contains no implementation

E_OUTOFMEMORY

Out of memory

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.

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.

Setting and Retrieving the Privacy Level

To specify the privacy level when creating the queue, set MSMQQueueInfo.PrivLeveland call the MSMQQueueInfo.Createmethod.

To reset the privacy level of an open queue, set MSMQQueueInfo.PrivLevelto a new level and call the MSMQQueueInfo.Updatemethod.

This method updates the queue information stored by Message Queuing.

For public queues, this information is stored in the directory service.

To retrieve the stored privacy level of a queue, call the MSMQQueueInfo.Refreshmethod and inspect the MSMQQueueInfo.PrivLevelproperty.

Encrypting messages

Private messages can be encrypted in two ways.

  • By the sending queue manager

  • By the sending application

Equivalent Function property

When using functions, the privacy level of the queue can be set and retrieved using the PROPID_Q_PRIV_LEVEL property.

Requirements

Header mqoai.h
Library mqoa.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later