Azure-sdk-for-net: [FEATURE REQ] Get available versions of a Blob when using Blob Storage Versioning

Created on 1 Dec 2020  ·  7Comments  ·  Source: Azure/azure-sdk-for-net

Library or service name.
Azure.Storage.Blobs

Is your feature request related to a problem? Please describe.
I would love to use the versioning feature in Blob Storage to version JSON documents, however there is no easy way with the SDK to get the version IDs for a blob. There are methods to get a Blob by its name and versionId, but no obvious way to get the available versionIds for a Blob.

Client Service Attention Storage customer-reported needs-team-attention question

Most helpful comment

Thank you for your feedback. Tagging and routing to the team best able to assist.

All 7 comments

Thank you for your feedback. Tagging and routing to the team best able to assist.

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.


Issue Details

Library or service name.
Azure.Storage.Blobs

Is your feature request related to a problem? Please describe.
I would love to use the versioning feature in Blob Storage to version JSON documents, however there is no easy way with the SDK to get the version IDs for a blob. There are methods to get a Blob by its name and versionId, but no obvious way to get the available versionIds for a Blob.

Author: chrisdusyk-iq
Assignees: -
Labels: `Client`, `Service Attention`, `Storage`, `customer-reported`, `needs-team-attention`, `needs-triage`, `question`
Milestone: -

Hi,

Does this sample not list the versions for you or are you referring to something else? https://docs.microsoft.com/en-us/azure/storage/blobs/versioning-enable?tabs=portal#list-blob-versions

@seanmcc-msft Is there a method that allows for listing the versions of a blob? Or would you have to use GetBlobs and set the prefix to be the blob name in question to list the blob version?

Hi,

Does this sample not list the versions for you or are you referring to something else? https://docs.microsoft.com/en-us/azure/storage/blobs/versioning-enable?tabs=portal#list-blob-versions

@seanmcc-msft Is there a method that allows for listing the versions of a blob? Or would you have to use GetBlobs and set the prefix to be the blob name in question to list the blob version?

I see these docs were added in November, and I hadn't looked through them again since I started looking at this in October. This looks more like what I need!

I have created a PR to implement this feature request - https://github.com/Azure/azure-sdk-for-net/pull/17461

We won't be able to add this feature correctly for now, we would need backend service support. https://github.com/Azure/azure-sdk-for-net/pull/17461#discussion_r540521259

@chrisdusyk-iq, the best work around for you to get the version for a blob is to call BlobContainerClient.GetBlobs(prefix: [blob name], states: BlobStates.Version), and then filter out the BlobItems that aren't associated with the blob in question. This is a limiation in the backend service.

Please re-open if you have further questions!

Was this page helpful?
0 / 5 - 0 ratings