1
votes

I am facing the issue while downloading of azure blob file with old file being downloaded.Here are the steps.

While uploading.. following code is used.

                BlobClient blobClient = containerClient.GetBlobClient(fileNamePrefix);
                if (blobClient.Exists())
                {
                    await blobClient.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots);
                    await blobClient.UploadAsync(stream, true);
                }

While above process works well, and in blob storage, i see updated file, if the same blob already existed.

After this is done, If i perform download operation.

BlobClient blobClient = containerClient.GetBlobClient(blobName);
await blobClient.DownloadToAsync(mstream);

I still see old file. So even though, new file exists in storage, the operation gives me old file.

It's baffling why it happening, but any idea's would be useful.

Thank you.

1
You have to use BlobClient for Delete of snapshot. await blobClient.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots, null, default);r2018
thanks! it works perfectMandar Jogalekar
i thought it did work. but it doesn't the download part still downloads the older version.in storage the file appears overwritten perfectly.Mandar Jogalekar
@MandarJogalekar which version of the blob package you're using? and how big is the blob file? and you'd better provide a sample code which can be used to produce the issue, I think there might be a minor error in your code.Ivan Yang
i use azure.storage.blobs 12.7.0 . blob file i test with is very small 5-10 Kbs. . I provide a code above in the question alreadyMandar Jogalekar

1 Answers

0
votes

Putting it here so anyone else faces problem. Will help them.

You have to use BlobClient for Delete of snapshot. await blobClient.DeleteIfExistsAsync(DeleteSnapshotsOption.IncludeSnapshots, null, default);

Please mark this as answer for others :)