Delete
MSMQQueueInfo

The Delete method deletes an existing queue (it does not delete the MSMQQueueInfo object used to create the queue).

Syntax

object.Delete
 
Syntax Element Description
object The queue information (MSMQQueueInfo) object that defines the queue.

Return Codes

For information on return codes, see MSMQ Error and Information Codes.

Remarks

Deleting the queue does not delete the MSMQQueueInfo object, only the existing queue. You can still create a new queue based on the current properties of the MSMQQueueInfo object.

When deleting public queues, some clients may still see the queue registered in MQIS after the queue was deleted. Changes to MQIS (such as deleting a public queue) are propagated from site to site, which can cause delays in viewing the most current information. Consequently, clients in some sites 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.

Example

This example assumes at least one queue whose label is "Test Queue" already exist. It runs a query for the test queues, asking if you want to delete each queue it finds.

To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, and then run the example and click the form.

Dim query As New MSMQQuery
Dim qinfos As MSMQQueueInfos
Dim qinfo As MSMQQueueInfo
Dim Response As String


Private Sub Form_Click()

   Set qinfos = query.LookupQueue(Label:="Test Queue")
   qinfos.Reset
   Set qinfo = qinfos.Next

   While Not qinfo Is Nothing
      Response = MsgBox("Delete queue: " + qinfo.Label, vbYesNo)
      
      If Response = vbYes Then
         qinfo.Delete
      End If
      
      Set qinfo = qinfos.Next
   Wend
   
End Sub 
 

See Also

Label, LookupQueue, MSMQQuery, MSMQQueueInfos, MSMQQueueInfo, Next, Reset


© 1997 by Microsoft Corporation. All rights reserved.