Setting a Queue's Properties Using ActiveX Components

The properties of a queue can be dynamically set by calling the MSMQQueueInfo object's Update method. Update can only be called on queues that exist. It cannot be called on an MSMQQueueInfo object before the queue is created or after the queue is deleted.

When Update is called, Active Directory (public queues) and the local computer (private queues) are updated with the current settings of the MSMQQueueInfo object's properties.

Note  Properties for private queues can only be updated if the queue is located on the local computer.

    To set a queue's properties
  1. Determine whether the application has the access rights needed to set the queue's properties. If the application does not have MQSEC_SET_QUEUE_PROPERTIES access rights, an MQ_ERROR_ACCESS_DENIED error is returned to Update. For a complete list of queue access rights, see Access Control.
  2. Set the queue properties that need to be changed to a new value.
  3. Call Update.

Example

This example creates a public queue and then uses Update to change the queue's label. To try this example using Microsoft® Visual Basic® (version 5.0), paste the code into the Declaration section of a form that has a single text box, run the example, and click the form.

Dim qinfo As New MSMQQueueInfo

Private Sub Form_Click()
    
  Set qinfo = New MSMQQueueInfo
  qinfo.PathName = ".\UpdateTest1"
  qinfo.Label = "Test Queue"
  qinfo.Create
  MsgBox "The queue's label is: " + qinfo.Label
  
  qinfo.Label = "New Queue Label"
  qinfo.Update
  MsgBox "The queue's new label is: " + qinfo.Label

End Sub
 

Queue properties

The following queue properties can be set by calling Update:

Authenticate

BasePriority

Journal

JournalQuota

Label

PrivLevel

Quota

ServiceTypeGuid

The following properties cannot be set by Update:

CreateTime (set by MSMQ)

IsTransactional (set when queue is created)

ModifyTime (set by MSMQ)

PathName (set when queue is created)

QueueGuid (set by MSMQ)