AzureBlobFileSystem icon indicating copy to clipboard operation
AzureBlobFileSystem copied to clipboard

System.MissingMethodException in AzureBlobStorageProvider.RenameFile

Open ghost opened this issue 9 years ago • 2 comments

Calling the method AzureBlobFileSystem.AzureBlobStorageProvider.RenameFile results in System.MissingMethodException. Using AzureBlobFileSystem, Version=0.0.7.0.

Using WindowsAzure.Storage Version=7.0.0 (see: https://www.nuget.org/packages/WindowsAzure.Storage), the method CloudBlockBlob.StartCopyFromBlob(Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob, Microsoft.WindowsAzure.Storage.AccessCondition, Microsoft.WindowsAzure.Storage.AccessCondition, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions, Microsoft.WindowsAzure.Storage.OperationContext) is Obsolete, see: https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblockblob.startcopyfromblob.aspx

An alternative pattern for performing Blob Rename (unoptimized):

  1. Get old blob as a stream
  2. Create new blob using stream from #1
  3. Delete old blob

ghost avatar Apr 22 '16 16:04 ghost

I see, StartCopyFromBlob is obsolete now.

With the latest azure storage sdk, we need to do something like

using (var stream = await sourceBlob.OpenReadAsync())
{
  await destinationBlob.UploadFromStreamAsync(stream);
}

Don't you want to try clone this repo and make a PR with fix? It would be very much appreciated.

pofider avatar Apr 24 '16 09:04 pofider

@pofider This downloads the data to your program and reuploads it. The new library has StartCopy()/StartCopyAsync()

Dmitry-Me avatar Feb 10 '17 09:02 Dmitry-Me