Visual Basic Code Example: Retrieving MSMQQueueInfo.IsWorldReadable2

 

This example provides a function that receives the path name of an existing queue and returns the Boolean value of the MSMQQueueInfo.IsWorldReadable2 property for it.

This function can return the IsWorldReadable2 property of a local private queue from information stored on the local computer, but must retrieve information stored in the directory service to return the IsWorldReadable2 property of a local or remote public queue. This function cannot be used to obtain the IsWorldReadable2 property of a remote private queue.

To retrieve MSMQQueueInfo.IsWorldReadable2.

  1. Declare the objects needed to retrieve queue properties. This routine declares an MSMQQueueInfo object.

  2. Create the MSMQQueueInfo object. This example then uses MSMQQueueInfo.PathName to set the path name to the string passed to the function.

  3. Call MSMQQueueInfo.Refresh to obtain the current registered settings of the queue properties.

System_CAPS_noteNote

This call retrieves the settings of all properties of the queue with the path name set. If no such queue exists, an error message is displayed.

  1. Return the local setting of MSMQQueueInfo.IsWorldreadable2.

The following code example requires MSMQ 3.0.

Function GetWorldReadable( _
                          strPathname As String _
                          ) As Boolean
  Dim qinfo As MSMQQueueInfo

  ' Create the MSMQQueueInfo object.
  Set qinfo = New MSMQQueueInfo
  qinfo.PathName = strPathname
  On Error GoTo ErrorHandler

  ' Retrieve the internally registered property values.
  qinfo.Refresh

  ' Return the local setting of MSMQQueueInfo.IsWorldReadable2.
  GetWorldReadable = qinfo.IsWorldReadable2
  Exit Function

ErrorHandler:
  MsgBox "Error " + Hex(Err.Number) + " was returned." _
          + Chr(13) + Err.Description
End Function

Community Additions

ADD
Show: