ShareDirectoryClient.ForceCloseHandle(String, CancellationToken) Method


The ForceCloseHandle(String, CancellationToken) operation closes a handle opened on a directory or a file at the service. It supports closing a single handle specified by handleId.

This API is intended to be used alongside GetHandles(Nullable<Boolean>, CancellationToken) to force close handles that block operations, such as renaming a directory. These handles may have leaked or been lost track of by SMB clients. The API has client-side impact on the handle being closed, including user visible errors due to failed attempts to read or write files. This API is not intended for use as a replacement or alternative for SMB close.

For more information, see Force Close Handles.

public virtual Azure.Response<Azure.Storage.Files.Shares.Models.CloseHandlesResult> ForceCloseHandle (string handleId, System.Threading.CancellationToken cancellationToken = default);
abstract member ForceCloseHandle : string * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Files.Shares.Models.CloseHandlesResult>
override this.ForceCloseHandle : string * System.Threading.CancellationToken -> Azure.Response<Azure.Storage.Files.Shares.Models.CloseHandlesResult>
Public Overridable Function ForceCloseHandle (handleId As String, Optional cancellationToken As CancellationToken = Nothing) As Response(Of CloseHandlesResult)



Specifies the handle ID to be closed.


Optional System.Threading.CancellationToken to propagate notifications that the operation should be cancelled.



A Response<T> describing the status of the ForceCloseHandle(String, CancellationToken) operation.


A RequestFailedException will be thrown if a failure occurs.

Applies to