Checking if a blob exists in Azure Storage

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Checking if a blob exists in Azure Storage

Message par Clippy »

Checking if a blob exists in Azure Storage
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Checking if a blob exists in Azure Storage

Message par Clippy »

The new API has the .Exists() function call. Just make sure that you use the `GetBlockBlobReference`, which doesn't perform the call to the server. It makes the function as easy as:

```
public static bool BlobExistsOnCloud(CloudBlobClient client,
string containerName, string key)
{
return client.GetContainerReference(containerName)
.GetBlockBlobReference(key)
.Exists();
}

```
Répondre

Revenir à « Azure Infrastructure »