NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MessageQueue.GetPublicQueues (MessageQueueCriteria)

Retrieves a set of public queues filtered by the specified criteria.

[Visual Basic]
Overloads Public Shared Function GetPublicQueues( _
   ByVal criteria As MessageQueueCriteria _
) As MessageQueue ()
[C#]
public static MessageQueue[] GetPublicQueues(
   MessageQueueCriteria criteria
);
[C++]
public: static MessageQueue* GetPublicQueues(
   MessageQueueCriteria* criteria
) [];
[JScript]
public static function GetPublicQueues(
   criteria : MessageQueueCriteria
) : MessageQueue[];

Parameters

criteria
The MessageQueueCriteria that is used to filter the queues.

Return Value

An array of MessageQueue objects that reference the public queues retrieved.

Remarks

Use this overload to filter public queues by multiple criteria, like both Label and MachineName. Use this overload also to filter by a property for which there is no specific method, such as a queue's last modification time. You must define and instantiate a MessageQueueCriteria object, setting the properties on the object as appropriate.

If you want to restrict the list by criteria like MachineName, Label, or Category, use GetPublicQueuesByMachine, GetPublicQueuesByLabel, or GetPublicQueuesByCategory, respectively.

GetPublicQueues retrieves a static snapshot of the queues. To interact with a dynamic queue list, use GetMessageQueuesEnumerator.

GetPublicQueues cannot be used to retrieve private or system queue information.

GetPublicQueues is a static (in Visual Basic Shared) member, so it can be called using the MessageQueue class itself. It is not necessary to create an instance of MessageQueue in order to call the method.

Example [Visual Basic]

The following example gets a list of public queues which have been modified within the previous 24 hours. The example assumes that there is a computer on the network with the name "myComputer".

[Visual Basic]

Private Sub GetPublicQueuesByCriteria()
    'Define an array to hold the queues.
    Dim mqList() As MessageQueue
    'This is used in the for loop.
    Dim i As Integer
    'This holds the information about the last modified time.
    Dim mqModified As System.DateTime
    'The criteria to filter queues by.
    Dim criteria As MessageQueueCriteria

    'This will get the queues modified within the last 24 hours.
    mqModified = DateTime.Now.Subtract(New TimeSpan(1, 0, 0, 0))

    'Set criteria information.
    criteria = New MessageQueueCriteria
    criteria.MachineName = "myComputer"
    criteria.ModifiedAfter = mqModified

    'Get the public queues that meet the criteria.
    mqList = MessageQueue.GetPublicQueues(criteria)
End Sub

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | MessageQueue.GetPublicQueues Overload List | GetPublicQueuesByLabel | GetPublicQueuesByMachine | GetPublicQueuesByCategory