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.
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
The following queue properties can be set by calling Update:
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)