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

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

Copying one Azure blob to another blob in Azure Storage Client 2.0
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

[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 »