The Refresh method refreshes the property values of the MSMQQueueInfo object. These values are retrieved from MQIS (public queues) or from the local computer (private queues).
object.Refresh
Syntax Element | Description |
object | The queue information (MSMQQueueInfo) object that defines the queue. |
All queue properties can be retrieved, however, you can only retrieve the properties of private queues if they are located on your local computer.
Refresh is typically used when more than one user is using the queue. For example, if user 1 locates the queue and then user 2 modifies the queue's properties, user 1 needs to call Refresh to sync up with user 2's changes.
After a queue is created, the properties of the MSMQQueueInfo object are not updated until Refresh is explicitly called, or the queue is closed and reopened. For example, even though MSMQ sets CreateTime, ModifyTime, or QueueGuid when it creates the queue, the application must call Refresh to update the properties of the MSMQQueueInfo object before it can read those properties.
For a complete discussion on retrieving a queue's properties, see Retrieving a Queue's Properties Using ActiveX Components.
Refresh uses the MQGetQueueProperties function.
This example creates a public queue, then uses Refresh to update the MSMQQueueInfo so it can display the queue's identifier (QueueGuid). To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form that has a single text box, and then run the example and click the form.
Dim qinfo As MSMQQueueInfo Private Sub Form_Click() Set qinfo = New MSMQQueueInfo qinfo.PathName = ".\RefreshTest" qinfo.Label = "Test Queue" qinfo.Create qinfo.Refresh 'Required to update QueueGuid Text1.Text = "quidQueue = " + CStr(qinfo.QueueGuid) End Sub
Create,Label, MSMQQueueInfo, PathName, QueueGuid