[QUERY] BlockBlobClient.OpenWriteAsync with overwrite: false
See original GitHub issueQuery/Question
If I call BlockBlobClient.OpenWriteAsync(overwrite: false)
I get 'System.ArgumentException' in System.Private.CoreLib.dll: 'BlockBlobClient.OpenWrite only supports overwriting'
. Why can’t I set overwrite
to false? If I set overwrite: true
and then set options: new BlockBlobOpenWriteOptions { OpenConditions = new BlobRequestConditions { IfNoneMatch = new ETag("*") } }
it seems to behave as it should, throwing an exception if I try to open a blob that already exists.
Environment:
- Name and version of the Library package used: Azure.Storage.Blobs 12.10.0
- Hosting platform or OS and .NET runtime version (
dotnet --info
output for .NET Core projects): Windows 10 .NET 5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
c# - How to set overwrite in Azure BlobClient when using ...
To perform a partial update of the content of a block blob, use the Azure.Storage.Blobs.Specialized.BlockBlobClient.StageBlock(System.String, ...
Read more >BlockBlobClient streaming API generates incorrect content ...
BlockBlobClient streaming API generates incorrect content hash [BUG] #16779 ... OpenWriteAsync(overwrite: true, options: options);.
Read more >BlockBlobClient.OpenWriteAsync Method - Storage
Opens a stream for writing to the blob. If the blob exists, it will be overwritten.
Read more >Class BlockBlobClient | Azure SDK for .NET
The BlockBlobClient allows you to manipulate Azure Storage block blobs. ... Stream> OpenWriteAsync (bool overwrite, ... The default value is false. System.
Read more >Untitled
Blockblobclient openwriteasync Webpublic async Task BlockBlobWriteStreamOpenWithAccessConditionAsync () { CloudBlobContainer container ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, thanks. I thought of that, but then dismissed it because it seemed so inconsistent with the rest of the use of the word “overwrite” in the API, and because the API docs did not say that it is what it meant. When re-reading it after your message, I can see the docs could mean both things “Whether an existing blob should be deleted and recreated.”
Note: this workaround is not fool proof for Archived blobs – if you’re catching a
409 BlobAlreadyExists
, in case of an archived blob it throws a409 BlobArchived