Alex Gordon
Alex Gordon

Reputation: 60751

how to get the full blob path from CloudBlockBlob

Is it possible to get the full path of a CloudBlockBlob?

I have an output binding to a CloudBlockBlob:

[Blob("%Detach:OutputContainer%/{file}", FileAccess.Write)] CloudBlockBlob @out

Here's how I am writing to this output:

await @out.UploadTextAsync("some string");

How do we get the full blob path of this CloudBlockBlob without having to parse %Detach:OutputContainer%/{file}?

The reason I am asking is because when my function has completed, I'd like to automatically add a queue message with this binding:

[Queue("%Detach:DoneQueue%")] ICollector<Done> q,

I am doing something like: q.Add(@out.HowDoWeGetThisBlobPath()) ?

Upvotes: 0

Views: 1195

Answers (1)

Mike S
Mike S

Reputation: 3169

Name, Container, and URI are all already identified on the Blob instance when it's passed into the ctor. The call to Upload() is just writing the contents.

So you should be able to do:

q.Add(@out.Uri);

More on CloudBlob properties: https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.blob.cloudblob.uri?view=azure-dotnet

Upvotes: 2

Related Questions