Пример #1
0
        public static void ClearStorage(TypeTable typeTable)
        {
            // Create storagecredentials object by reading the values from the configuration (appsettings.json)
            StorageCredentials storageCredentials = new StorageCredentials(accountName: CloudStorage.Instance.GetAccountCloudStorage(typeTable).AccountName,
                                                                           CloudStorage.Instance.GetAccountCloudStorage(typeTable).AccountKey);

            // Create cloudstorage account by passing the storagecredentials
            CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, true);

            // Create the blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // Get reference to the blob container by passing the name by reading the value from the configuration (appsettings.json)
            CloudBlobContainer container = blobClient.GetContainerReference(CloudStorage.Instance.GetAccountCloudStorage(typeTable).Container);

            if (container.Exists())
            {
                container.Delete();
            }
        }