CopyBlob Method
Copies a source blob to a destination blob within the same storage account.
Syntax
int CopyBlob(char* lpszblobName, char* lpsznewContainer, char* lpsznewBlobName);
Remarks
This method is used to copy a source blob specified by blobName and contained within ContainerName to a destination blob within a container specified by newContainer with a name of newBlobName.
The following scenarios are supported by the copy blob operation:
- You can copy a source blob (blobName) to a destination blob (newBlobName) with a different name from that of the source blob. The destination blob can be an existing blob, or a new blob created by the copy operation.
- You can copy a source blob (blobName) to a destination blob (newBlobName) with the same name, effectively replacing the source blob. Such a copy operation removes any uncommitted blocks and overwrites the blob's metadata.
- You can copy a snapshot (blobName) over its base blob (newBlobName). By promoting a snapshot to the position of the base blob, you can restore an earlier version of a blob. Note if you wish to copy a snapshot of a blob, you will need to set BlobSnapshot prior to calling CopyBlob
- You can copy a snapshot (blobName) to a destination blob (newBlobName) with a different name. The resulting destination blob is a writable blob and not a snapshot. Note if you wish to copy a snapshot of a blob, you will need to set BlobSnapshot prior to calling CopyBlob.
If the destination blob (newBlobName) has an active lease, LeaseId must be specified prior to calling CopyBlob.