Thomas Murphy
Thomas Murphy

Reputation: 41

Azure Storage Copy From Blob

I am having an issue converting the Console app described here .Copying an existing blob into a media services asset to run on mobile app service

I have everything like for like refernces wise and code wise but have the following issue

// Display the size of the source blob.
Console.WriteLine(sourceBlob.Properties.Length);
Console.WriteLine(string.Format("Copy blob '{0}' to '{1}'", sourceBlob.Uri, destinationBlob.Uri));

// The line below gives the following error:
destinationBlob.StartCopyFromBlob(new Uri(sourceBlob.Uri.AbsoluteUri + signature));

Blockquote 'ICloudBlob' does not contain a definition for 'StartCopyFromBlob' and no extension method 'StartCopyFromBlob' accepting a first argument of type 'ICloudBlob' could be found (are you missing a using directive or an assembly reference?

Is this because i am using version 7 of the storage client and the method has been removed?

If so is there a new method of combination of methods that i can use to achieve a similar result?

Upvotes: 2

Views: 2153

Answers (2)

Bruce Chen
Bruce Chen

Reputation: 18465

As Zhaoxing Lu said that 'ICloudBlob' does not contain a definition for 'StartCopy'. Base on your code, you could find 'StartCopy' in CloudBlockBlob class.

According to the tutorial you mentioned, you could modify the type of destinationBlob:

CloudBlockBlob destinationBlob = destinationContainer.GetBlockBlobReference(sourceBlob.Name);

Instead of:

ICloudBlob destinationBlob = destinationContainer.GetBlockBlobReference(sourceBlob.Name);

Note: CloudBlobContainer.GetBlockBlobReference returns a CloudBlockBlob object.

Then you could run the following code:

destinationBlob.StartCopy(new Uri(sourceBlob.Uri.AbsoluteUri + signature));

Upvotes: 1

Zhaoxing Lu
Zhaoxing Lu

Reputation: 6467

From the release notes, you can find:

Blobs: Removed deprecated (Begin/End)StartCopyFromBlob(Async) APIs in favor of using (Begin/End)StartCopy(Async) APIs.

Therefore, please use StartCopy instead of StartCopyFromBlob.

Upvotes: 3

Related Questions