CloudBlob.deleteIfExists Method

Definition

Overloads

deleteIfExists()

Deletes the blob if it exists.

A blob that has snapshots cannot be deleted unless the snapshots are also deleted. If a blob has snapshots, use the DeleteSnapshotsOption#DELETE_SNAPSHOTS_ONLY or DeleteSnapshotsOption#INCLUDE_SNAPSHOTS value in the parameter to specify how the snapshots should be handled when the blob is deleted.

deleteIfExists(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Deletes the blob if it exists, using the specified snapshot and request options, and operation context.

A blob that has snapshots cannot be deleted unless the snapshots are also deleted. If a blob has snapshots, use the DeleteSnapshotsOption#DELETE_SNAPSHOTS_ONLY or DeleteSnapshotsOption#INCLUDE_SNAPSHOTS value in the parameter to specify how the snapshots should be handled when the blob is deleted.

deleteIfExists()

Deletes the blob if it exists.

A blob that has snapshots cannot be deleted unless the snapshots are also deleted. If a blob has snapshots, use the DeleteSnapshotsOption#DELETE_SNAPSHOTS_ONLY or DeleteSnapshotsOption#INCLUDE_SNAPSHOTS value in the parameter to specify how the snapshots should be handled when the blob is deleted.

public final boolean deleteIfExists()
Returns
final boolean

true if the blob was deleted; otherwise, false.

Exceptions

If a storage service error occurred.

deleteIfExists(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)

Deletes the blob if it exists, using the specified snapshot and request options, and operation context.

A blob that has snapshots cannot be deleted unless the snapshots are also deleted. If a blob has snapshots, use the DeleteSnapshotsOption#DELETE_SNAPSHOTS_ONLY or DeleteSnapshotsOption#INCLUDE_SNAPSHOTS value in the parameter to specify how the snapshots should be handled when the blob is deleted.

public final boolean deleteIfExists(final DeleteSnapshotsOption deleteSnapshotsOption, final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)
Parameters
deleteSnapshotsOption
final DeleteSnapshotsOption

A DeleteSnapshotsOption object that indicates whether to delete only snapshots, or the blob and its snapshots.

accessCondition
final AccessCondition

An AccessCondition object that represents the access conditions for the blob.

options
BlobRequestOptions

A BlobRequestOptions object that specifies any additional options for the request. Specifying null will use the default request options from the associated service client ( CloudBlobClient).

opContext
OperationContext

An OperationContext object that represents the context for the current operation. This object is used to track requests to the storage service, and to provide additional runtime information about the operation.

Returns
final boolean

true if the blob existed and was deleted; otherwise, false

Exceptions

If a storage service error occurred.