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