In the guide for BlobClient, it states that UploadAsync: "creates the blob if it doesn't already exist, and overwrites it if it does."
However, when calling UploadAsync with an existing file name (even though both methods state the same), I get a 409 The specified blob already exists error.
Is it possible that this should read that it "overwrites any existing metadata on the blob" ?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Okay, so after some investigation, it appears that you must use the overload with the second boolean parameter set to true (default is false) in order to utilise the behaviour described in the documentation.
Might be worth correcting the doc to say that you must pass this parameter to overwrite the blob.
@Reisclef Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.
@Reisclef thank you for the feedback. I've updated the code to use the overload you recommended.
Thanks!
~ _Mark_
Not sure if this is the right location, but the API documentation for UploadAsync
is still incorrect.
The UploadAsync(String, CancellationToken) operation creates a new block blob or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob.
I don't think this API is actually updating the blob, since when doing so I get the following response:
Status: 409 (The specified blob already exists.)
ErrorCode: BlobAlreadyExists
Not sure if this is also the case for the regular Upload
method, but I would assume it is incorrect aswell.
Most helpful comment
Okay, so after some investigation, it appears that you must use the overload with the second boolean parameter set to true (default is false) in order to utilise the behaviour described in the documentation.
Might be worth correcting the doc to say that you must pass this parameter to overwrite the blob.