<div class="content" name="Delete" uuid="fa0973ca-6d6b-431c-b5b4-8bbeffc4e458"><p>The Delete method deletes all <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_d864e01b-9fb1-4beb-9864-8221d293445a" data-linktype="relative-path">plexes</a> in a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_9a876829-33a1-4f0b-8b81-8552b7e5561c" data-linktype="relative-path">volume</a>.<a id="Appendix_A_Target_118"></a><a aria-label="Product behavior note 118" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_118" data-linktype="relative-path">&lt;118&gt;</a></p><dl>
<dd>
<div><pre> HRESULT Delete(
   [in] long bForce
 );
</pre></div>
</dd></dl><p><b>bForce: </b>A Boolean that determines whether all
plexes in a volume are deleted when the volume is in use.</p><p><b>Return Values: </b>The method MUST return zero or
a non-error <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_799103ab-b3cb-4eab-8c55-322821b2b235" data-linktype="relative-path">HRESULT</a> (as
specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>)
to indicate success, or return an implementation-specific nonzero error code to
indicate failure. For the HRESULT values predefined by the Virtual Disk Service
Remote Protocol, see section <a href="5102cc53-3143-4268-ba4c-6ea39e999ab4" data-linktype="relative-path">2.2.3</a>.</p><p><b>ERROR_SUCCESS</b> (0x00000000)</p><p>When the server receives this message, it MUST perform the
following:</p><ul><li><p><span><span> 
</span></span>Attempt to get exclusive access to the volume. If the server
fails to get exclusive access to the volume, and the <i>bForce</i> parameter is
not set to true, then the server MUST return VDS_E_DEVICE_IN_USE.</p>
</li><li><p><span><span> 
</span></span>Delete all <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_7d1df68a-9ec5-4f84-a64f-67888f39405d" data-linktype="relative-path">volume
plexes</a> in the volume. Remove the corresponding volume plex objects from the
list of storage management objects.<a id="Appendix_A_Target_119"></a><a aria-label="Product behavior note 119" href="6b2552ee-ba27-409f-99a8-18841573327a#Appendix_A_119" data-linktype="relative-path">&lt;119&gt;</a></p>
</li><li><p><span><span> 
</span></span>Remove this volume object from the list of storage management objects.</p>
</li><li><p><span><span> 
</span></span>For each callback object that is registered in the list of
callback objects, call the callback object&#39;s <a href="04a70bf6-208d-463a-b0a4-cc96e198ded1" data-linktype="relative-path">IVdsAdviseSink::OnNotify()</a>
method with a <a href="4f29057f-ab32-4a3d-9fcb-00ba3457cb42" data-linktype="relative-path">VDS_NOTIFICATION</a>
structure with the following attributes:</p>
<ul><li><p><span><span>  </span></span>objectType
member is VDS_NTT_VOLUME.</p>
</li><li><p><span><span>  </span></span>Volume
member is a <a href="410540de-982d-4db1-991e-a73efed4e6f0" data-linktype="relative-path">VDS_VOLUME_NOTIFICATION</a>
with the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_VOLUME_DEPART.</p>
</li><li><p><span><span> 
</span></span><b>volumeId</b> is the <a href="9186f1ce-04de-4df2-a8cf-3925a02fcd47" data-linktype="relative-path">VDS_OBJECT_ID</a> of this
volume.</p>
</li><li><p><span><span> 
</span></span><b>plexId</b> is NULL GUID, but it is not relevant when ulEvent
is VDS_NF_VOLUME_DEPART.</p>
</li><li><p><span><span> 
</span></span><b>ulPercentCompleted</b> range is 0-100 and is
implementation-specific; however, it is not relevant when ulEvent is
VDS_NF_VOLUME_DEPART.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>If the volume resided on a <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_425be2e8-ca0d-45db-afba-d9daee040d07" data-linktype="relative-path">basic disk</a>, for each
callback object that is registered in the list of callback objects, call the
callback object&#39;s IVdsAdviseSink::OnNotify() method with a VDS_NOTIFICATION
structure with the following attributes:</p>
<ul><li><p><span><span>  </span></span>objectType
member is VDS_NTT_PARTITION.</p>
</li><li><p><span><span>  </span></span>Partition
member is a VDS_PARTITION_NOTIFICATION with the following attributes:</p>
<ul><li><p><span><span> 
</span></span>ulEvent is VDS_NF_PARTITION_DEPART.</p>
</li><li><p><span><span> 
</span></span>diskId is the VDS_OBJECT_ID of the <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disk</a> object on which the
volume resided.</p>
</li><li><p><span><span> 
</span></span>ullOffset is the byte offset at which the volume&#39;s partition
started on the disk.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>If the volume resides on a basic disk and if the partition the
volume resides on is the last remaining partition in an <a href="8eef5d42-22d7-4302-aed9-12face91505a#gt_af7c97a3-0702-421f-b936-a062a176c100" data-linktype="relative-path">extended partition</a>, delete
the extended partition as well. Then for each callback object registered in the
list of callback objects, call the callback object&#39;s IVdsAdviseSink::OnNotify()
method with a VDS_NOTIFICATION structure with the following attributes:</p>
<ul><li><p><span><span>  </span></span>objectType
member is VDS_NTT_PARTITION.</p>
</li><li><p><span><span>  </span></span>Partition
member is a <a href="72738b43-1afe-4b36-9978-eddcbcbfca55" data-linktype="relative-path">VDS_PARTITION_NOTIFICATION</a>
with the following attributes:</p>
<ul><li><p><span><span> 
</span></span>ulEvent is VDS_NF_PARTITION_DEPART.</p>
</li><li><p><span><span> 
</span></span>diskId is the VDS_OBJECT_ID of the disk object on which the
extended partition resided.</p>
</li><li><p><span><span> 
</span></span>ullOffset is the byte offset at which the extended partition
started on the disk.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>If the volume resided on a basic disk, for each callback object
registered in the list of callback objects, call the callback object&#39;s
IVdsAdviseSink::OnNotify() method with a VDS_NOTIFICATION structure with the
following attributes:</p>
<ul><li><p><span><span>  </span></span><b>objectType</b>
member is VDS_NTT_DISK.</p>
</li><li><p><span><span>  </span></span><b>Disk</b>
member is a <a href="1478f791-1ebd-421c-ba87-5fd7493dafd1" data-linktype="relative-path">VDS_DISK_NOTIFICATION</a>
with the following attributes:</p>
<ul><li><p><span><span> 
</span></span><b>ulEvent</b> is VDS_NF_DISK_MODIFY.</p>
</li><li><p><span><span> 
</span></span><b>diskId</b> is the VDS_OBJECT_ID of the disk object on which
the volume resided.</p>
</li></ul></li></ul></li><li><p><span><span> 
</span></span>Return an HRESULT indicating failure or success.</p>
</li></ul></div>