MessageQueue::QueueName Property

 

Gets or sets the friendly name that identifies the queue.

Namespace:   System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

public:
[BrowsableAttribute(false)]
[MessagingDescriptionAttribute("MQ_QueueName")]
property String^ QueueName {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The name that identifies the queue referenced by this MessageQueue. The value cannot be null.

Exception Condition
ArgumentException

The queue name is null.

You can combine the QueueName with the MachineName to create a friendly Path name for the queue. The syntax for the friendly name variation of the Path property depends on the type of queue, as shown in the following table.

Queue type

Syntax

Public queue

MachineName\QueueName

Private queue

MachineName\Private$\QueueName

Journal queue

MachineName\QueueName\Journal$

Use "." to represent the local computer.

Changing the QueueName property affects the Path property. If you set the QueueName without setting the MachineName property, the Path property becomes .\QueueName. Otherwise, the Path becomes MachineName\QueueName.

The following table shows whether this property is available in various Workgroup modes.

Workgroup mode

Available

Local computer

Yes

Local computer and direct format name

Yes

Remote computer

Yes

Remote computer and direct format name

No

The following code example gets and sets the value of a message queue's QueueName property.

// Set the queue's QueueName property value.
queue.QueueName = "Example Queue";

// Display the new value of the queue's QueueName property.
Console.WriteLine("MessageQueue.QueueName: {0}", queue.QueueName);

.NET Framework
Available since 1.1
Return to top
Show: