private void DeleteBackup(CloudBlockBlob blob) { Log.Info("Deleting Blob: {0}", blob.Uri.AbsoluteUri); if (!WhatIf) { blob.DeleteIfExists(DeleteSnapshotsOption.IncludeSnapshots, accessCondition: AccessCondition.GenerateIfMatchCondition(blob.Properties.ETag)); } }
protected override void OnExecuting(CloudBlockBlob workItem) { if (workItem == null) throw new ArgumentNullException("workItem"); workItem.DeleteIfExists(); string message = string.Format(CultureInfo.InvariantCulture, Resources.SnapshotCleaner_Deleted_Snapshot_Confirmation, workItem.Uri, workItem.SnapshotTime); Report(message); }
private static void DeleteIfExists(CloudBlockBlob blob) { try { blob.DeleteIfExists(); } catch (StorageException e) { throw new BlobException(string.Format(CultureInfo.InvariantCulture, "Could not DeleteIfExists blob named '{0}' from container. See inner exception for details.", blob.Name), e); } }
private static void DeleteBlob(CloudBlockBlob blockBlob) { int attempt = 0; int MaxAttempts = 3; while (++attempt <= MaxAttempts) { try { blockBlob.DeleteIfExists(); break; } catch (Exception ex) { if (attempt == MaxAttempts) { throw ex; } Thread.Sleep(100); } } }
private static void DeleteBlob(string packageUrl, string storageAccountName, string storageAccountKey) { OurTrace.TraceInfo(string.Format("Deleting blob {0}", packageUrl)); var packageUri = new Uri(packageUrl); var credentials = new StorageCredentials(storageAccountName, storageAccountKey); var blobRef = new CloudBlockBlob(packageUri, credentials); blobRef.DeleteIfExists(); }