Monday, September 20, 2021

Import Files from Blob storage using X++ - D365 FnO

 using Microsoft.WindowsAzure.Storage;

 Using Microsoft.WindowsAzure.Storage.Blob;

 class RunnableClassBlobStorageDownload

 {

     /// 

     /// Runs the class with the specified arguments.     /// 


     /// 

The specified arguments.

     public static void main(Args _args)

     {

         CloudBlobDirectory  cloudBlobDirectory;

         CloudBlobClient  cloudBlobClient;

         CloudBlobContainer  cloudBlobContainer;

         CloudStorageAccount  cloudStorageAccount;

         cloudStorageAccount  = CloudStorageAccount::Parse("Azure Blob Connection String");

         cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();

         cloudBlobContainer  = cloudBlobClient.GetContainerReference("files"); // 

         System.Collections.IEnumerable lstEnumarable =   cloudBlobContainer.ListBlobs(null, false, 0, null, null);

         System.Collections.IEnumerator lstEnumarator = lstEnumarable.GetEnumerator();

         List filenames = new List(Types::String);

         while(lstEnumarator.MoveNext())

         {

             IListBlobItem item = lstEnumarator.Current;

             if(item is CloudBlockBlob)

             {

                 CloudBlockBlob blob = item;

                 System.IO.StreamReader  reader = new System.IO.StreamReader(blob.OpenRead(null, null, null));

                 Info(reader.ReadToEnd());           

             }

         }

     }

 }

No comments:

Post a Comment

Copying and Auto populating financial dimension from inventSite X++

 APPROACH 1 //calling method DimensionAttributeValueSetStorage  valueStorage = this.getDefaultDimension(inventsite); purchTable.defaultdimen...