<div class="content" name="CreateNewElement" uuid="6e12c978-ef4c-42e2-8b64-814f56e3077e"><p>The CreateNewElement method is received by the server in an
RPC_REQUEST packet. In response, the server creates a new unattached <a href="59774887-09e3-4de5-ad8e-4794f404b123" data-linktype="relative-path">IAppHostElement</a> object
that has the specified name. The name MUST be a supported name as defined by
the <a href="9b7dbefe-84a8-418d-a9c2-4c00d9552a03" data-linktype="relative-path">IAppHostCollectionSchema</a>
of the specified <a href="5b32b6df-8364-4ba9-8d04-bfe0a4891a57" data-linktype="relative-path">IAppHostElementCollection</a>.</p><dl>
<dd>
<div><pre> HRESULT CreateNewElement(
   [in, defaultvalue(&#34;&#34;)] BSTR bstrElementName,
   [out, retval] IAppHostElement** ppElement
 );
</pre></div>
</dd></dl><p><b>bstrElementName: </b>The name of the
IAppHostElement to be created.</p><p><b>ppElement: </b>Contains a new IAppHostElement
object.</p><p><b>Return Values: </b>The server MUST return zero if
it successfully processes the message that is received from the client. In this
case, *ppElement is not NULL. If processing fails, the server MUST return a
nonzero <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
code as defined in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.
The following table describes the error conditions that MUST be handled and the
corresponding error codes. A server MAY return additional
implementation-specific error codes.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0X00000000 NO_ERROR</td>
  <td>The operation completed successfully.</td>
 </tr><tr>
  <td>0X80070057 ERROR_INVALID_PARAMETER</td>
  <td>One or more parameters are incorrect or null.</td>
 </tr><tr>
  <td>0X00000008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>Not enough memory is available to process this command.</td>
 </tr><tr>
  <td>0X80070021 ERROR_LOCK_VIOLATION</td>
  <td>The instance is not editable.</td>
 </tr><tr>
  <td>0X80070585 ERROR_INVALID_INDEX</td>
  <td>The schema does not permit the creation of an element with name bstrElementName.</td>
 </tr></tbody></table>
</dd></dl><p> </p></div>