<div class="content"><p>The Purge method is received by the server in an RPC_REQUEST
packet. In response, the server purges all <a href="../ms-mqdmpr/9170afda-9524-4abd-91fe-8c53e51e0def" data-linktype="relative-path">Message</a>s
in the MessagePositionList of the <i>referenced queue</i>.</p><dl>
<dd>
<div><pre> HRESULT Purge();
</pre></div>
</dd></dl><p>This method has no parameters.</p><p><b>Return Values: </b>The method MUST return S_OK
(0x00000000) on success or an implementation-specific error <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
on failure.</p><p>When processing this call, the <a href="3b7be3f7-651c-4f9c-930b-a9a7c4355ad8#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a> MUST follow these
guidelines:</p><ul><li><p><span><span> 
</span></span>If the <i>IsInitialized</i> instance variable equals False:</p>
<ul><li><p><span><span>  </span></span>Return
an error OLE_E_BLANK (0x80040007), and take no further action.</p>
</li></ul></li><li><p><span><span> 
</span></span>If the <i>IsClosed</i> instance variable equals True:</p>
<ul><li><p><span><span>  </span></span>Return
an error MQ_ERROR_INVALID_HANDLE (0xC00E0007), and take no further action.</p>
</li></ul></li><li><p><span><span> 
</span></span>If refQueue.AccessType is not equal to ReceiveAccess or
ReceiveAdminAccess:</p>
<ul><li><p><span><span>  </span></span>Return
an error MQ_ERROR_ACCESS_DENIED (0xC00E0025), and take no further action.</p>
</li></ul></li><li><p><span><span> 
</span></span>Else:</p>
<ul><li><p><span><span>  </span></span>Remove
all the Messages with Message.Locked not equal to Locked in the
refQueue.MessagePositionList by raising the Purge Queue event with refQueue as
the only argument.</p>
</li><li><p><span><span>  </span></span>Return
S_OK (0x00000000), and take no further action.</p>
</li></ul></li></ul></div>