Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Connect D365 finOps to...
Finance forum

Connect D365 finOps to Azure file storage

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

i'm using Azure file storage to read file from fileshare and insert data to D365 finOps. I begin testing it with x++ and if import was succeded i copy the file in fileshare in another folder. the problem is when i try to copy file i try different method on the  Microsoft.WindowsAzure.Storage.File.CloudFile but i get this error : 

'UploadFromFileAsync(System.String, System.IO.Stream)' is not found on type 'Microsoft.WindowsAzure.Storage.File.CloudFile'

Could you help me ?

below my code :
// Set Azure storage auth credentials
StorageCredentials credentails = new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(storageAccountName, storageAccountKey);
        
// Find Azure cloud storage account
CloudStorageAccount cloudStorageAccount = new Microsoft.WindowsAzure.Storage.CloudStorageAccount(credentails, true);
        
// Create cloud file client
CloudFileClient cloudFileClient = cloudStorageAccount.CreateCloudFileClient();

// Get Azure cloud file share created on Azure portal
CloudFileShare  cloudFileShare = cloudFileClient.GetShareReference(azureStorageShareName);

if(cloudFileShare.Exists(null, null))
{
   // Get cloud file share root directory
   CloudFileDirectory rootDirectory = cloudFileShare.GetRootDirectoryReference();

   if(rootDirectory.Exists(null, null))
   {
       // Get directory on file share root directory
       CloudFileDirectory sourceDir = rootDirectory.GetDirectoryReference('Groupe/HCBA');

       if (sourceDir.Exists(null, null))
       {
           // Get file
           CloudFile file = sourceDir.GetFileReference('Group CB HSO NN 1.0 1200000NU HSONN GFX EAM perpetual license.lic');

           if (file.Exists(null, null))
           {
               // Delete file
               //file.Delete(null, null, null);
                        
               CloudFileDirectory destDir = rootDirectory.GetDirectoryReference('Groupe/HCBA/bak');

               if (destDir.Exists(null, null))
               {
                  System.Uri path = file.Uri;

                  file.UploadFromFileAsync(file.Uri.ToString(), file.OpenRead(null, null, null));
               }        
           }
       }         
   }
}

Thanks,

Best regards 

MOALLA Mehdi

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Connect D365 finOps to Azure file storage

    Hi all,

    The solution is to create a c# project and add reference to AX. 

    Thanks 

  • Jie G Profile Picture
    Jie G on at
    RE: Connect D365 finOps to Azure file storage

    Hello Mehdi,

    Check the Microsoft.WindowsAzure.Storage.dll on your server where your code is running and compare its version with the one your code reference. There should be a mismatch.

  • Suggested answer
    Joris dG Profile Picture
    Joris dG 17,775 on at
    RE: Connect D365 finOps to Azure file storage

    It's quite possible the web server has its own version of this DLL that is older than the one you reference (check packageslocaldirectory/bin or webroot or webroot/bin). This method may not exist or have a different method signature on that older version. Your only option is to use whatever version the platform is currently using, knowing that if it gets updated your code may break.

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans