Setting a Queue's Properties Using API Functions

The properties of a queue can be dynamically set by calling MQSetQueueProperties. All open instances of the queue are immediately affected when MQSetQueueProperties is called.

Note  In most cases, any application can set a queue's properties. However, if MQ_ERROR_ACCESS_DENIED is returned to the MQSetQueueProperties call, the queue's access control is blocking the application from setting its properties. For information about access rights, see Access Control.

Not all properties can be set by MQSetQueueProperties. The following table indicates the properties that can be set and that cannot.

Property Set by MQSetQueueProperties
PROPID_Q_AUTHENTICATE Yes
PROPID_Q_BASEPRIORITY Yes
PROPID_Q_CREATE_TIME No (set by MSMQ when queue is created)
PROPID_Q_INSTANCE No (set by MSMQ when public queue is created)
PROPID_Q_JOURNAL Yes
PROPID_Q_JOURNAL_QUOTA Yes
PROPID_Q_LABEL Yes
PROPID_Q_MODIFY_TIME No (set by MSMQ)
PROPID_Q_PATHNAME No (set when queue is created)
PROPID_Q_PRIV_LEVEL Yes
PROPID_Q_QUOTA Yes
PROPID_Q_TRANSACTION No (set when queue is created)
PROPID_Q_TYPE Yes

    To set a queue's properties
  1. Determine the format name of the queue. If the format name of the queue is not known, you can obtain its format name by using one of the following format name translation functions:

    MQHandleToFormatName

    MQInstanceToFormatName

    MQPathNameToFormatName

  2. Specify the properties you want to retrieve.
  3. Call MQSetQueueProperties.