Copying one Azure blob to another blob in Azure Storage Client 2.0

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

Copying one Azure blob to another blob in Azure Storage Client 2.0

Message par Clippy »

Copying one Azure blob to another blob in Azure Storage Client 2.0
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Copying one Azure blob to another blob in Azure Storage Client 2.0

Message par Clippy »

[Gaurav Mantri](http://gauravmantri.com/) has written a series of articles on Azure Storage on version 2.0. I have taken this code extract from his blog post of [Storage Client Library 2.0 – Migrating Blob Storage Code](http://gauravmantri.com/2012/11/28/storage-client-library-2-0-migrating-blob-storage-code/) for Blob Copy

```
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer sourceContainer = cloudBlobClient.GetContainerReference(containerName);
CloudBlobContainer targetContainer = cloudBlobClient.GetContainerReference(targetContainerName);
string blobName = "";
CloudBlockBlob sourceBlob = sourceContainer.GetBlockBlobReference(blobName);
CloudBlockBlob targetBlob = targetContainer.GetBlockBlobReference(blobName);
targetBlob.StartCopyFromBlob(sourceBlob);

```
Répondre

Revenir à « Azure Infrastructure »