MQDeleteQueue

The MQDeleteQueue function deletes a queue from Active Directory (in the case of public queues) or from the local computer (in the case of private queues).

HRESULT APIENTRY MQDeleteQueue(
  LPCWSTR lpwcsFormatName  
);
 

Parameters

lpwcsFormatName
[in] Pointer to the queue's format name buffer. This buffer contains the format name string of the queue to be deleted.

Return Values

MQ_OK
Indicates success.
MQ_ERROR_ACCESS_DENIED
The process does not have the access rights to delete this queue. To change access rights, call MQSetQueueSecurity.
MQ_ERROR_ILLEGAL_FORMATNAME
The specified format name in lpwcsFormatName is illegal.
MQ_ERROR_NO_DS
Cannot access Active Directory.
MQ_ERROR_SERVICE_NOT_AVAILABLE
Cannot connect to the Queue Manager.
MQ_ERROR_UNSUPPORTED_FORMATNAME_OPERATION
Cannot delete a queue using a direct format name.
MQ_ERROR_WRITE_NOT_ALLOWED
Cannot delete a queue from Active Directory.

Remarks

The format name of the queue (specified by lpwcsFormatName) cannot be a direct format name.

When deleting a public queue, some clients may still see the queue registered in Active Directory after the queue has been deleted. A change to Active Directory (such as deleting a public queue) is propagated from domain controller to domain controller, which can cause delays in the availability of new information. Consequently, clients using a specific domain controller may still try to send messages to the queue, even though it was deleted. Propagation delays, including communication network delays such as down links, are controlled by the MSMQ Administrator.

Public queues cannot be deleted if there is no connection to Active Directory. This restriction applies to dependent client computers, independent client computers that are working offline, and MSMQ routing servers (FRS). (For information on offline operations, see MSMQ Offline Support.)

Examples

For an example of using MQDeleteQueue, see Deleting a Queue.

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mq.h.
  Import Library: Use mqrt.lib.
  Unicode: Defined only as Unicode.

See Also

MQCloseQueue, MQCreateQueue, MQOpenQueue, MQSetQueueSecurity