Retrieving a Queue's Properties Using ActiveX Components

After a queue is created, the MSMQQueueInfo object's properties can be reset at any time by calling the object's Refresh method.

Refresh has two uses. It is required before an application can read any queue property that is set by MSMQ (MSMQ-generated properties such as QueueGuid cannot be used until Refresh is called). Second, it can be used to refresh the properties of the MSMQQueueInfo object when another application resets a queue's properties. When Refresh is called, it updates all of the queue's properties, not just those set by the application. However, you can only refresh the properties of private queues if the queue is located on your local computer. To see a list of queue properties, scroll to the bottom of this topic.

Note  Properties of public queues can also be retrieved by doing a query on Active Directory. For details, see Locating a Public Queue.

    To retrieve a queue's properties
  1. Determine whether the sending application has the access rights to look at the queue's properties. If the application does not have MQSEC_GET_QUEUE_PROPERTIES access rights, an MQ_ERROR_ACCESS_DENIED error is returned to Refresh. For a complete list of queue access rights, see Access Control.
  2. Call Refresh.

Example

This example creates a public queue and 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 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 = ".\RefreshTest"
  qinfo.Label = "Test Queue"
  qinfo.Create
   
  qinfo.Refresh          'Required to update QueueGuid
  Text1.Text = "quidQueue = " + CStr(qinfo.QueueGuid)
 
End Sub
 

Queue Properties

The following queue properties can be retrieved:

Authenticate

BasePriority

Journal

JournalQuota

Label

PrivLevel

Quota

ServiceTypeGuid

The following queue properties are set by MSMQ when it creates the queue. To read these properties, the application must explicitly call Refresh before they can be read.

CreateTime (public queues only)

FormatName (public and private queues)

IsTransactional (public and private queues)

ModifyTime (public queues only)

QueueGuid (public queues only)