<div class="content" name="R_SetUserAcknowledgementClass" uuid="add5b3ed-7b02-48df-af90-a304ed0b9eea"><p>The <b>R_SetUserAcknowledgementClass</b> method sets the
acknowledgment class property of a <span><a href="b23ea276-dfad-4083-bc48-d0f8a40255fd#gt_85c78cf0-1fb6-4e5d-85f5-a2e9f58a6b9e" data-linktype="relative-path">message</a></span> in the <span><a href="b23ea276-dfad-4083-bc48-d0f8a40255fd#gt_c1a6400d-703b-4f9a-a74c-40f1487978d9" data-linktype="relative-path">queue</a></span>.
This allows marking the message as rejected.<a id="Appendix_A_Target_30"></a><a aria-label="Product behavior note 30" href="4108f68e-80f5-40e1-b3df-b713cc4dff79#Appendix_A_30" data-linktype="relative-path">&lt;30&gt;</a> This
method MUST be called subsequent to calls to <b>R_StartTransactionalReceive</b>
and R_EndTransactionalReceive (Opnum 15) (section <span><a href="f15f7fba-9259-4641-ab05-08a0485f5a8a" data-linktype="relative-path">3.1.4.15)</a></span>
and before the transaction is committed or aborted.</p><dl>
<dd>
<div><pre> HRESULT R_SetUserAcknowledgementClass(
   [in] handle_t hBind,
   [in] QUEUE_CONTEXT_HANDLE_NOSERIALIZE phContext,
   [in] ULONGLONG LookupId,
   [in] USHORT usClass
 );
</pre></div>
</dd></dl><p><b>hBind: </b>MUST be an <span><a href="b23ea276-dfad-4083-bc48-d0f8a40255fd#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> binding handle
parameter, as specified in <span><a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a></span>
section <span><a href="../ms-rpce/a01f5886-c485-4bcf-bb23-e0d755510ab7" data-linktype="relative-path">2</a></span>.</p><p><b>phContext: </b>MUST be set by the client to a <span><a href="3e818e81-b12a-4ccd-9606-f434c346a3e9" data-linktype="relative-path">QUEUE_CONTEXT_HANDLE_NOSERIALIZE</a></span>
handle representing the queue containing the message on which to set the
acknowledgment class. The handle MUST have been returned by the server in the <i>pphQueue</i>
output parameter of a prior call to the R_OpenQueue (Opnum
2) (section <span><a href="b4b3001c-f2ff-4a17-9830-7b21af371dc4" data-linktype="relative-path">3.1.4.2)</a></span> method
with the <i>dwAccess</i> parameter set to MQ_RECEIVE_ACCESS and MUST NOT have
been closed through a prior call to the R_CloseQueue (Opnum
3) (section <span><a href="e480114a-587f-4110-b03b-7a6188cca307" data-linktype="relative-path">3.1.4.3)</a></span> method.
This value MUST NOT be NULL.</p><p><b>LookupId: </b>MUST be set by the client to the
lookup identifier of the message on which to set the acknowledgment class.</p><p><b>usClass: </b>The acknowledgment class to set. It
MUST be set by the client to one of the following values.</p><table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x0000</td>
  <td>No-op. No change is made to the acknowledgment class.</td>
 </tr><tr>
  <td>MQMSG_CLASS_NACK_RECEIVE_REJECTED 0xC004</td>
  <td>Marks the message as rejected.</td>
 </tr></tbody></table><p><b>Return Values: </b>On success, this method MUST return
MQ_OK (0x00000000).</p><p>If an error occurs, the server MUST return a failure <span><a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a></span>,
and the client MUST treat all failure <b>HRESULT</b>s identically.</p><p><b>MQ_OK</b> (0x00000000)</p><p><b>MQ_ERROR_INVALID_HANDLE</b> (0xC00E0007)</p><p><b>MQ_ERROR_TRANSACTION_USAGE</b> (0xC00E0050)</p><p><b>MQ_ERROR_MESSAGE_NOT_FOUND</b> (0xC00E0088)</p><p>Exceptions Thrown:</p><p>No exceptions are thrown except those thrown by the
underlying RPC protocol, as specified in [MS-RPCE].</p><p>When processing this call, the server MUST do the following:</p><ul><li><p><span><span> 
</span></span>Find the corresponding <b>OpenQueueDescriptor</b> ADM element
instance <i>fOpenQueueDescriptor</i> by comparing the <i>phContext</i>
parameter with the <b>Handle</b> ADM attribute for all <b>OpenQueueDescriptor</b>
ADM element instances maintained by the local <b>QueueManager</b> ADM element
instance.</p>
</li><li><p><span><span> 
</span></span>If not found, return a failure <b>HRESULT</b>.</p>
</li><li><p><span><span> 
</span></span>Find the corresponding <b>MessagePosition</b> (<span><a href="../ms-mqdmpr/5eafe0a6-a22f-436b-a0d9-4cbc25c52b47" data-linktype="relative-path">[MS-MQDMPR]</a></span>
section <span><a href="../ms-mqdmpr/be575c24-2a25-42cf-a4d7-61780c10230d" data-linktype="relative-path">3.1.1.11</a></span>)
ADM element instance <i>fMessagePosition</i> by comparing the <i>LookupId</i>
parameter with <i>rMessagePosition</i>.<b>MessageReference</b>.<b>Identifier</b>
for each <b>MessagePosition</b> ADM element instance <i>rMessagePosition</i> in
the <i>fOpenQueueDescriptor</i>.<b>QueueReference.MessagePositionList</b>.</p>
</li><li><p><span><span> 
</span></span>If not found, then return MQ_ERROR_MESSAGE_NOT_FOUND
(0xC00E0088).</p>
</li><li><p><span><span> 
</span></span>Find the corresponding <b>TransactionOperation</b> ADM element
instance <i>fTransactionOperation</i> by comparing the <b>MessagePosition</b>
ADM element instance <i>fMessagePosition</i> with <i>rTransaction</i>.<b>TransactionalOperationCollection.MessagePositionReference</b>
for each <b>Transaction</b> ADM element instance <i>rTransaction</i> in the <b>TransactionCollection</b>
ADM attribute of the local <b>QueueManager</b> ADM element instance.</p>
</li><li><p><span><span> 
</span></span>If not found, then return MQ_ERROR_TRANSACTION_USAGE
(0xC00E0050).</p>
</li><li><p><span><span> 
</span></span>If the <i>usClass</i> parameter is not 0x0000, set the <b>DequeueReason</b>
ADM attribute of the <b>TransactionOperation</b> ADM element instance <i>fTransactionOperation</i>
to <b>NackReceiveRejected</b>, as specified in [MS-MQDMPR] section <span><a href="../ms-mqdmpr/9170afda-9524-4abd-91fe-8c53e51e0def" data-linktype="relative-path">3.1.1.12</a></span>.</p>
</li><li><p><span><span> 
</span></span>Return MQ_OK (0x00000000).</p>
</li></ul></div>