<div class="content"><p align="right"><a href="https://msdn.microsoft.com/en-us/library/cd0efce0-13fb-4106-87db-4bef73bb4b1b" data-linktype="external">msdn link</a></p><p>The SamrCreateUserInDomain method creates a user.</p><dl>
<dd>
<div><pre> long SamrCreateUserInDomain(
   [in] SAMPR_HANDLE DomainHandle,
   [in] PRPC_UNICODE_STRING Name,
   [in] unsigned long DesiredAccess,
   [out] SAMPR_HANDLE* UserHandle,
   [out] unsigned long* RelativeId
 );
</pre></div>
</dd></dl><p><b>DomainHandle: </b>An RPC context handle, as
specified in section <a href="8138c078-d881-4d1f-b378-94b4c34a287a" data-linktype="relative-path">2.2.7.2</a>,
representing a <a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_2346e8d0-b0a0-481f-b644-85c45c60d4d1" data-linktype="relative-path">domain object</a>.</p><p><b>Name: </b>The value to use as the name of the
user. See the message processing shown later in this section for details on how
this value maps to the data model.</p><p><b>DesiredAccess: </b>The access requested on the <i>UserHandle</i>
on output. See section <a href="c0be3f43-bcf9-43ee-b027-3d02ab372c53" data-linktype="relative-path">2.2.1.7</a>
for a listing of possible values.</p><p><b>UserHandle: </b>An RPC context handle, as
specified in section 2.2.7.2.</p><p><b>RelativeId: </b>The <a href="7b2aeb27-92fc-41f6-8437-deb65d950921#gt_df3d0b61-56cd-4dac-9402-982f1fedc41c" data-linktype="relative-path">RID</a> of the newly created
user.</p><p>This protocol asks the RPC runtime, via the <b>strict_context_handle</b>
attribute, to reject the use of context handles created by a method of a
different RPC interface than this one, as specified in <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>
section <a href="../ms-rpce/38ae9f5a-dac2-46ad-b2b7-9c43f211d9f6" data-linktype="relative-path">3</a>.</p><p>The server MUST behave as with a call to <a href="a98d7fbb-1735-4fbf-b41a-ef363c899002" data-linktype="relative-path">SamrCreateUser2InDomain</a>
with the following parameter values.</p><table><thead>
  <tr>
   <th>
   <p>Parameter name</p>
   </th>
   <th>
   <p>Parameter value</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p><i>DomainHandle</i></p>
  </td>
  <td>
  <p>SamrCreateUserInDomain.DomainHandle</p>
  </td>
 </tr><tr>
  <td>
  <p><i>Name</i></p>
  </td>
  <td>
  <p>SamrCreateUserInDomain.Name</p>
  </td>
 </tr><tr>
  <td>
  <p><i>AccountType</i></p>
  </td>
  <td>
  <p>USER_NORMAL_ACCOUNT</p>
  </td>
 </tr><tr>
  <td>
  <p><i>DesiredAccess</i></p>
  </td>
  <td>
  <p>SamrCreateUserInDomain.DesiredAccess</p>
  </td>
 </tr><tr>
  <td>
  <p><i>UserHandle</i></p>
  </td>
  <td>
  <p>SamrCreateUserInDomain.UserHandle</p>
  </td>
 </tr><tr>
  <td>
  <p><i>RelativeId</i></p>
  </td>
  <td>
  <p>SamrCreateUserInDomain.RelativeId</p>
  </td>
 </tr></tbody></table><p> </p></div>