1

I am trying to upload a file to a new container of a Blob following this Example.

I am creating the container like this and looks fine.

var blobStorage = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobStorage.GetContainerReference("productimages");
if (container.CreateIfNotExists())
{
    var permissions = container.GetPermissions();
    permissions.PublicAccess = BlobContainerPublicAccessType.Container;
    container.SetPermissions(permissions);
}

But trying to call the GetBlockBlobReference from a CloudBlobContainer shows me that the method doesn't exist.

string uniqueBlobName = string.Format("productimages/image_{0}{1}", guid, ext);
CloudBlockBlob blob = blobStorage.GetBlockBlobReference(uniqueBlobName);

I have been trying to obtain documentation about the method, but it looks like is no longer avaliable in docs.microsoft. I think than I am doing somethign fool. Any help is welcome.

Sergio
  • 57
  • 2
  • 10

2 Answers2

1

I found aditional problems in my solution including the one mentioned by nlawalker. After updating Windows.Storage at the end I solved my problem based in the most upvoted answer of this Question

Sergio
  • 57
  • 2
  • 10
  • 3
    This is now null and void when using .NET Core 3.1 because Microsoft has once again, in it's unknown wisdom, decided to refactor the Azure API's into yet another complicated structure. I should know as I am currently trying to upgrade an API from .NET Core 2.2 to .NET Core 3.1! What a pain with all the unnecessary changes! – ScottyMacDev Sep 28 '20 at 23:57
0

GetBlockBlobReference is a method on CloudBlobContainer. The documentation for this method is here.

nlawalker
  • 6,364
  • 6
  • 29
  • 46