SalimAzureBlobAPI/SalimAzureAPI/AzureBlob/BlobService.cs
/// <summary>
/// Deletes the specified blob from the specified container if it exists.
/// </summary>
/// <param name="blobName">The blob "file" to delete.</param>
/// <param name="azureAppSettings">The azure application settings.</param>
/// <returns></returns>
Deletes the specified blob from the specified container if it exists.
Deletes the specified blob from the specified container if it exists .
public async Task<bool> DeleteBlob(string blobName, IOptions<AzureBlobSettings> azureAppSettings)
        {
            try
            {
                GetAzureBlobStorageAccountContainer(azureAppSettings);
                CloudBlobContainer container = _blobClient.GetContainerReference(_blobContainerName);
                _blockBlob = container.GetBlockBlobReference(blobName);
                await _blockBlob.DeleteAsync();
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;
        }
public async Task < bool > DeleteBlob ( string blobName , IOptions < AzureBlobSettings > azureAppSettings ) { try { GetAzureBlobStorageAccountContainer ( azureAppSettings ) ; CloudBlobContainer container = _blobClient . GetContainerReference ( _blobContainerName ) ; _blockBlob = container . GetBlockBlobReference ( blobName ) ; await _blockBlob . DeleteAsync ( ) ; } catch ( Exception ex ) { return false ; } return true ; }
Deletes the specified blob from the specified container if it exists.
Deletes the specified blob from the specified container if it exists .
None
blobName
string
The blob "file" to delete.
The blob " file " to delete .
azureAppSettings
IOptions<AzureBlobSettings>
The azure application settings.
The azure application settings .