MessageQueue.CanWrite Property
Assembly: System.Messaging (in system.messaging.dll)
CanWrite indicates whether the application is able to send messages to the queue. If CanWrite is true, the MessageQueue can send messages to the queue. Otherwise, it cannot.
CanWrite is false if a queue is already open with exclusive write access (or if it's open with non-exclusive access and this MessageQueue requests exclusive access), or if the application does not have sufficient rights to access it. If your application tries to write to a queue when CanWrite is false, access is denied.
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 | No |
| Remote computer and direct format name | Yes |
The following code example displays the value of a message queue's CanWrite property.
// Display the value of the queue's CanWrite property. Console.WriteLine("MessageQueue.CanWrite: {0}", queue.CanWrite);
// Display the value of the queue's CanWrite property.
Console.WriteLine("MessageQueue.CanWrite: {0}",
System.Convert.ToString(queue.get_CanWrite()));
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.