The Refresh method refreshes the property values of the MSMQQueueInfo object. These values are retrieved from Active Directory (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 queue's properties, see Retrieving a Queue's Properties Using ActiveX Components.
Refresh uses the MQGetQueueProperties function.
This example creates a public queue, and 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, 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
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mqoai.h.
Import Library: Use mqoa.lib.
Unicode: Defined only as Unicode.
Create, Label, MSMQQueueInfo, PathName, QueueGuid