none
Not Able To Copy Azure Cloud File To Another Directory !

    Întrebare

  • Hi,

    I am trying to copy a cloud file from one directory to another within same file share account but facing issue.

    Code:

    Below is the code I am using

    ( Reference: https://docs.microsoft.com/en-us/azure/storage/files/storage-dotnet-how-to-use-files#copy-files

     public bool ArchiveTheFile(string filename)
            {
                bool fileMoved = false;
                try
                {
                    var fileshare = ResolveCloudFileShare();
                    if (fileshare.Exists())
                    {
                        CloudFileDirectory rootDir = fileshare.GetRootDirectoryReference();
                        CloudFileDirectory dirSource = rootDir.GetDirectoryReference(ConfigurationManager.AppSettings["Azure.Storage.FileShare.Source"]);
                        CloudFileDirectory dirArchive = rootDir.GetDirectoryReference(ConfigurationManager.AppSettings["Azure.Storage.FileShare.Destination"]);
    
                        // Ensure that the directory exists.
                        if (dirSource.Exists())
                        {
                            // Get a reference to the file we created previously.
                            CloudFile sourceFile = dirSource.GetFileReference(filename);
    
                            // Ensure that the file exists.
                            if (sourceFile.Exists())
                            {
                                // Ensure that the directory exists.
                                if (dirArchive.Exists())
                                {
                                    // Get a reference to the destination file.
                                    CloudFile destFile = dirArchive.GetFileReference(filename);
                                    destFile.StartCopy(sourceFile);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                return fileMoved;
            }

    Error:

    Below is the error I am getting: 


    I am not able to find the root cause of above error .

    Please suggest the solution. 


    Sandeep Nandey



    10 mai 2018 07:05

Răspunsuri

  • I have updated the Microsoft.WindowsAzure.Storage to latest version ( 9.1.1 ) & this fixed the issue.

    Findings: 

    StartCopy for CloudFile is not supported until version 5.0.2.


    Sandeep Nandey


    16 mai 2018 04:25

Toate mesajele