Access
MSMQQueue

Read-only. The Access property indicates the access rights of the queue.

Quick Info

Type: Long
Run time: read-only

Syntax

object.Access
 
Syntax Element Description
object Queue (MSMQQueue) object that represents an instance of the queue.

Return Values

The Access property returns one of the following values:

MQ_SEND_ACCESS
Messages can only be sent to the queue.
MQ_PEEK_ACCESS
Messages can only be looked at. They cannot be removed from the queue.
MQ_RECEIVE_ACCESS
Messages can be taken out of the queue or peeked at.

Remarks

The Access property returns the access rights of the queue when it was last opened, regardless if the queue is currently open or closed.

Example

This example opens a queue for sending messages, then uses the value of Access to test how the queue was opened (with what access rights). To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, and then run the example and click the form.

Dim qinfo As MSMQQueueInfo
Dim q As MSMQQueue

Private Sub Form_Click()
    
  Set qinfo = New MSMQQueueInfo
  qinfo.PathName = ".\lAccessTest"
  qinfo.Label = "Test Queue"
  qinfo.Create
  
  Set q = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
   
  Select Case q.Access
     Case MQ_SEND_ACCESS
          MsgBox "The queue is open for sending messages."
     Case MQ_RECEIVE_ACCESS
          MsgBox "The queue is open for retrieve messages."
     Case MQ_PEEK_ACCESS
          MsgBox "The queue is open to peek at messages."
     Case Else
          MsgBox "Not a valid return value!"
  End Select
  q.Close
  
End Sub
 

See Also

Close, Create, Label, MSMQQueue, MSMQQueueInfo, Open, PathName


© 1997 by Microsoft Corporation. All rights reserved.