CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString); CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference("mycontainer"); CloudBlockBlob blob = container.GetBlockBlobReference("myfile.txt"); bool exists = blob.Exists();
CloudBlockBlob blob = new CloudBlockBlob(new Uri("https://mystorageaccount.blob.core.windows.net/mycontainer/myfile.txt"), new StorageCredentials(accountName, accountKey)) bool exists = blob.Exists();In this example, we create a new instance of CloudBlockBlob using its constructor and specify the URI of the blob we want to check. We also provide the storage account name and access key as StorageCredentials. We then call the Exists method on the blob to determine whether it exists. In summary, the CloudBlockBlob Exists method allows developers to check for the existence of a blob in Azure storage. This method is available in the Microsoft.WindowsAzure.Storage.Blob package library.