Jay
Jay

Reputation: 3082

CloudBlob not found in the new Microsoft.WindowsAzure.Storage what is its equivalent

I had the following code which was using the deprecated Microsoft.WindowsAzure.StorageClient and have upgraded to Microsoft.WindowsAzure.Storage and now I am unable to use the code below as it is not recognising the CloudBlob class, has this been totally removed or is there an equivalent class I can use in a similar manner

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

//the container for this is customerlogo
CloudBlobContainer container = blobClient.GetContainerReference(Container);
container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob });

//blob reference, this will be the company name in this case. it should not exist but if it does it will get overwritten.
CloudBlob blob = container.GetBlobReference(fileName);

Upvotes: 1

Views: 5016

Answers (1)

Serdar Ozler
Serdar Ozler

Reputation: 3802

Starting with Azure Storage Client Library 2.0, all blobs must be accessed via CloudPageBlob or CloudBlockBlob, since the CloudBlob base class has been removed. To get a reference to the concrete blob class when the client does not know the type, please see CloudBlobClient.GetBlobReferenceFromServer and CloudBlobContainer.GetBlobReferenceFromServer.

For migration from a pre-2.0 release to a newer version, I would recommend reading Windows Azure Storage Client Library 2.0 Breaking Changes & Migration Guide.

Upvotes: 1

Related Questions