<div class="content" name="DeleteNtmsDrive" uuid="8958776e-6cc6-47d7-9bda-2f3e522516ac"><p>The DeleteNtmsDrive method deletes a <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_1112c690-ee01-4c9b-aa55-9569fd82178b" data-linktype="relative-path">drive</a>.</p><dl>
<dd>
<div><pre> HRESULT DeleteNtmsDrive(
   [in] LPNTMS_GUID lpDriveId
 );
</pre></div>
</dd></dl><p><b>lpDriveId: </b>A pointer to the identifier of the
drive to delete.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 S_OK</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x80070005 ERROR_ACCESS_DENIED</td>
  <td>Access to an object was denied.</td>
 </tr><tr>
  <td>0x8007000F ERROR_INVALID_DRIVE</td>
  <td>The drive identifier is not valid.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>A parameter is not valid.</td>
 </tr><tr>
  <td>0x800710CD ERROR_INVALID_LIBRARY</td>
  <td>The library identifier is not valid.</td>
 </tr><tr>
  <td>0x800710D9 ERROR_DATABASE_FAILURE</td>
  <td>The database query or update failed.</td>
 </tr><tr>
  <td>0x800710DA ERROR_DATABASE_FULL</td>
  <td>The database is full.</td>
 </tr><tr>
  <td>0x8007139F ERROR_INVALID_STATE</td>
  <td>An unexpected state was encountered.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST verify that <i>lpDriveId</i>
is not NULL. If it is NULL, the server MUST immediately fail the operation and
return ERROR_INVALID_PARAMETER (0x80070057).</p><p>If parameter validation succeeds, the server MUST check
access rights to the library and verify that the library is enabled and offline
before further processing. If the client does not have the required access
rights, NTMS_MODIFY_ACCESS to the library is denied, and the server MUST return
ERROR_ACCESS_DENIED (0x80070005). Other security errors are possible but
indicate a security subsystem error. If the library is disabled or online, the
server MUST return ERROR_INVALID_STATE (0x8007139F).</p><p>If this drive belongs to a standalone library (that is, the
number of slots in the library is zero) the server MUST delete the library,
thereby leaving the media, drive and library objects in a state that is
consistent with the physical state.</p><p>The DeleteNtmsDrive method deletes a drive from the RSM
database. If the drive is not a standalone drive, then the drive MUST have <i>dwOperationalState</i>
set to NTMS_NOT_PRESENT. If the drive does not have <i>dwOperationalState</i>
set to NTMS_NOT_PRESENT, the server MUST fail the operation and return
ERROR_INVALID_STATE (0x8007139F).</p></div>