<div class="content" name="RemoteQMPurgeQueue" uuid="119644cf-f6ca-4f74-bb4a-c2624ccab22c"><p>The RemoteQMPurgeQueue method removes all <a href="33b1ac82-69ab-413c-9415-cd6f45d77156#gt_85c78cf0-1fb6-4e5d-85f5-a2e9f58a6b9e" data-linktype="relative-path">messages</a> from the <a href="33b1ac82-69ab-413c-9415-cd6f45d77156#gt_c1a6400d-703b-4f9a-a74c-40f1487978d9" data-linktype="relative-path">queue</a>.</p><p>Before calling this method, the <a href="0dbcb6fd-ed56-44c3-9c02-e9fa2d7798b3" data-linktype="relative-path">RemoteQMOpenQueue</a> method
MUST be called.</p><dl>
<dd>
<div><pre> HRESULT RemoteQMPurgeQueue(
   [in] handle_t hBind,
   [in] DWORD hQueue
 );
</pre></div>
</dd></dl><p><b>hBind: </b>MUST specify an <a href="33b1ac82-69ab-413c-9415-cd6f45d77156#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> binding handle
parameter, as specified in <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>
section <a href="../ms-rpce/a01f5886-c485-4bcf-bb23-e0d755510ab7" data-linktype="relative-path">2</a>.</p><p><b>hQueue: </b>A queue handle value acquired from the
<i>phQueue</i> parameter of the <a href="../ms-mqmp/47482511-3c4a-4d7e-8edb-46715e89e4af" data-linktype="relative-path">qmcomm:R_QMOpenRemoteQueue</a>
method as specified in <a href="../ms-mqmp/8e379aa2-802d-4fcc-b6a6-6203e4606fa9" data-linktype="relative-path">[MS-MQMP]</a>
section 3.1.4.2.</p><p><b>Return Values: </b>The method MUST return MQ_OK
(0x00000000) on success; otherwise, it MUST return a failure HRESULT, and the
client MUST treat all failure HRESULTs identically.</p><p><b>MQ_OK</b> (0x00000000)</p><p><b>MQ_ERROR_INVALID_HANDLE</b> (0xC00E0007)</p><p><b>Exceptions Thrown:</b> Failure HRESULTs returned by this
method MAY<a id="Appendix_A_Target_18"></a><a aria-label="Product behavior note 18" href="d6c5ba0a-aaf8-489d-baf2-fdc286b4bea4#Appendix_A_18" data-linktype="relative-path">&lt;18&gt;</a> be thrown as exceptions as well
as those thrown by the underlying RPC protocol, as specified in [MS-RPCE].</p><p>When processing this call, the server MUST:</p><ul><li><p><span><span> 
</span></span>Look up <b>OpenQueueEntry</b> in the <b>rOpenQueueEntryCollection</b>
where <b>OpenQueueEntry.OpenQueueDescriptorHandle</b>= <i>hQueue</i>.</p>
</li><li><p><span><span> 
</span></span>If no such entry is found, return MQ_ERROR_INVALID_HANDLE
(0xC00E0007).</p>
</li><li><p><span><span> 
</span></span>For each queue present in the <b>QueueManager.QueueCollection:</b></p>
<ul><li><p><span><span>  </span></span>For
each OpenQueueDescriptor in Queue.OpenQueueDescriptorCollection:</p>
<ul><li><p><span><span> 
</span></span>If<b>OpenQueueDescriptor.Handle</b>=<b>RemoteReadEntry.OpenQueueDescriptorHandle</b>,
use that <b>OpenQueueDescriptor</b> for processing.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>Generate a <a href="../ms-mqdmpr/19d74159-1a11-4486-8e9d-c54cebfe1088" data-linktype="relative-path">Purge
Queue</a> event (<a href="../ms-mqdmpr/5eafe0a6-a22f-436b-a0d9-4cbc25c52b47" data-linktype="relative-path">[MS-MQDMPR]</a>
section 3.1.7.1.7) with the following inputs:</p>
<ul><li><p><span><span>  </span></span>iQueue:=<b>QueueReference</b>
member of the <b>OpenQueueDescriptor</b> obtained earlier.</p>
</li></ul></li><li><p><span><span> 
</span></span>Return MQ_OK (0x00000000).</p>
</li></ul></div>