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.QueueName

Gets or sets the friendly name that identifies the queue.

[Visual Basic]
Overridable Public Property QueueName As String
[C#]
public string QueueName {virtual get; virtual set;}
[C++]
public: __property virtual String* get_QueueName();
public: __property virtual void set_QueueName(String*);
[JScript]
public function get QueueName() : String;
public function set QueueName(String);

Property Value

The name that identifies the reference to the MessageQueue. The value cannot be a null reference (Visual Basic Nothing).

Exceptions

Exception Type Condition
ArgumentException The queue name is a null reference (Visual Basic Nothing).
MessageQueueException The attempt to get or set the queue name generated an internal error on the message queue component. The error is specified by the given status message.

Remarks

You can use the QueueName together with the MachineName to set a friendly Path property for the queue. It is necessary to work on-line when doing so, since the domain controller contains the Active Directory which associates the friendly path with the FormatName which uniquely identifies the queue.

The syntax for the friendly name variation of the Path property depends on the type of queue it references. The following table shows the QueueName syntax you should use for a queue of a specified type:

Queue Type Syntax
Public Queue machineName\queueName
Private Queue machineName\Private$\queueName
Journal Queue machineName\queueName\Journal$

Use "." for the local computer.

If the Path has not been set when you set the queue name, the QueueName property points to a location on the local computer.

Example [Visual Basic]

The following example builds a queue path by appending the QueueName to the MachineName for the local computer.

This procedure examines a queue on a remote computer, and creates a queue with the same name on the local computer.

[Visual Basic]

Private Sub CreateQueueByQueueName(ByVal remotePath As String)
    'Define new MessageQueue objects.
    Dim remoteMessageQueue As MessageQueue
    Dim localMessageQueue As MessageQueue

    'Associate the MessageQueue with the given path.
    remoteMessageQueue = New MessageQueue(remotePath)

    'If no queue with the given name exists on the local computer, create one.
    If Not MessageQueue.Exists(".\" + remoteMessageQueue.QueueName) Then
        localMessageQueue = MessageQueue.Create(".\" + remoteMessageQueue.QueueName)
    End If
End Sub

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | Path | MachineName