Home > front end >  How to programmatically find out what operations I can do in a blob storage?
How to programmatically find out what operations I can do in a blob storage?

Time:11-27

I am using libraries enter image description here

const string sasToken = “SAS Token”

            const string accountName = "teststorage65";
            const string blobContainerName = "example";
            const string blobName = "test.txt";
            const string myFileLocation = @"Local Path ";

            var storageAccount = new CloudStorageAccount(storageCredentials, accountName, null, true);
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
            CloudBlobContainer blobContainer = blobClient.GetContainerReference(blobContainerName);
            var result=blobContainer.Exists();
            if (result == true)
            {
                Console.WriteLine("Container exists");
            }
            else
            {
               // blobContainer.CreateIfNotExists();
                Console.WriteLine("Conatiner not exists");

               Console.WriteLine("Creating Container   "  blobContainerName);
                blobContainer.CreateIfNotExists();
            }

               // blobContainer.CreateIfNotExists();
            //Console.WriteLine("Creating Container   ");
            CloudBlockBlob cloudBlob = blobContainer.GetBlockBlobReference(blobName);
            cloudBlob.UploadFromFile(myFileLocation);
        

OUTPUT

enter image description here

enter image description here

  • Related