web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Azure Storage - Move f...
Finance forum

Azure Storage - Move file to another directory

(0) ShareShare
ReportReport
Posted on by 20

Hello.

I'm working with Azore Storage API to download files from an Azure File Storage and process them accordingly. So far so good.

The problem begins when I try to move the processed files to another directory, e.g. ("azureFileShare\processedFiles"). I haven't found any function to move files, I only found the method  Microsoft.WindowsAzure.Storage.DataMovement.TransferManager.CopyAsync(CloudFile, CloudFile, Boolean, CopyOptions, SingleTransferContext), which I would use to copy the files and delete them afterward. But this namespace is not available inside D365FO.

Any ideas?

Thanks.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    You can simply use StartCopy() method of CloudFile class (namespace Microsoft.WindowsAzure.Storage.File, assembly Microsoft.WindowsAzure.Storage.dll).

    There is no method for movement, as far as I know, but you may want to verify it in a forum about Azure storage, not D365FO.

  • Lucas Figueredo BR Profile Picture
    20 on at

    Hi Martin,

    Thanks for your reply, but apparently the StartCopy is not available on this version of dll (v4.3.0.0). Do you think is there a way to update those Azure dlls? That's why I asked here, because it IS related to D365FO.

    stackoverflow.com/.../ms-azure-not-able-to-copy-azure-cloud-file-to-another-directory

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    Oh, that's a very old version. You're right, StartCopy() was introduced in version 5.0.2 (almost four years ago).

    I looked into it and found that Microsoft would like to update this library, but they're considering how to do it, because it'll be a breaking change. You may want to join the discussion on Yammer to put pressure on it.

    I don't think you can simply include a newer version and start using it.

    One option is using what you have available in 4.3.0.0. You don't have a copy, but you can get files and create new files, which can be combined into copying.

    If you have a library that would help you, you can add it as a reference and deploy it together with other artifacts. Just make sure it doesn't depend on things that you don't have in D365FO environments.

  • Suggested answer
    M Anas Khan Profile Picture
    1,424 on at

    This is how you can implement the move method for a 4.3.0.0 version DLL.

    sourceCloudFile.DownloadToStream(sourceFileMemoryStream, null, null, null);

    if (sourceFileMemoryStream.CanSeek)
    {
    sourceFileMemoryStream.Seek(0, System.IO.SeekOrigin.Begin);
    }

    targetCloudFile.UploadFromStream(sourceFileMemoryStream);
    sourceCloudFile.Delete();

  • Ben_BitDesign Profile Picture
    2 on at
    The suggested solution
    sourceCloudFile.Delete();
    Did not work for me, since it needs parameters.
     
    Therefore I used this instead:
    sourceCloudFile.DeleteAsync().Wait();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans