How to Put a Exported XML file from Xmlport to Azure Blob Container in BC 365 AL

devanshu_chaudhary
Member Posts: 7
Hello Everyone,
I wanted to achieve a task in which i am using an xmlport to export a xml file and trying to put that file into Azure Blob Storage Containers. Written the code something like this.This code is just placing a blank file on Azure, not my Exported Xml file which is in Outstream (OutStr). Please help with the edit in code
var
ABSContClient: Codeunit "ABS Container Client";
StorageAccount: Text;
Authorization: Interface "Storage Service Authorization";
ContainerName: Text;
Response: Codeunit "ABS Operation Response";
StorageServiceAuth: Codeunit "Storage Service Authorization";
SharedKey: Text;
ABSContainer: Record "ABS Container";
ABSBlobClient: Codeunit "ABS Blob Client";
ABSContainerContent: Record "ABS Container Content";
Ins: InStream;
FileName: Text;
OutStr: OutStream;
TempBlob: Codeunit "Temp Blob";
PersistanceBlob: Codeunit "Persistent Blob";
//begin
ClosedPO.RESET;
ClosedPO.SETRANGE("Is Exported", FALSE);
IF NOT ClosedPO.FINDSET THEN BEGIN
InsertLogEntry('Error', 'Nothing to Export');
CurrReport.BREAK;
END ELSE BEGIN
PurchPayableSetup.Get();
ContainerName := 'poclosure';
StorageAccount := PurchPayableSetup."Storage Account Name";
SharedKey := PurchPayableSetup."Access Key";
Authorization := StorageServiceAuth.CreateSharedKey(SharedKey);
ABSBlobClient.Initialize(StorageAccount, ContainerName, Authorization);
TempBlob.CreateOutStream(OutStr);
if XMLPORT.Export(50008, OutStr, ClosedPO) then begin
TempBlob.CreateInStream(Ins);
CopyStream(OutStr, Ins);
ABSBlobClient.PutBlobBlockBlobStream('Closed PO List: ' + format(CurrentDateTime), Ins);
InsertLogEntry('Export', 'XML File Export Successfully ');
end;
END;
I wanted to achieve a task in which i am using an xmlport to export a xml file and trying to put that file into Azure Blob Storage Containers. Written the code something like this.This code is just placing a blank file on Azure, not my Exported Xml file which is in Outstream (OutStr). Please help with the edit in code
var
ABSContClient: Codeunit "ABS Container Client";
StorageAccount: Text;
Authorization: Interface "Storage Service Authorization";
ContainerName: Text;
Response: Codeunit "ABS Operation Response";
StorageServiceAuth: Codeunit "Storage Service Authorization";
SharedKey: Text;
ABSContainer: Record "ABS Container";
ABSBlobClient: Codeunit "ABS Blob Client";
ABSContainerContent: Record "ABS Container Content";
Ins: InStream;
FileName: Text;
OutStr: OutStream;
TempBlob: Codeunit "Temp Blob";
PersistanceBlob: Codeunit "Persistent Blob";
//begin
ClosedPO.RESET;
ClosedPO.SETRANGE("Is Exported", FALSE);
IF NOT ClosedPO.FINDSET THEN BEGIN
InsertLogEntry('Error', 'Nothing to Export');
CurrReport.BREAK;
END ELSE BEGIN
PurchPayableSetup.Get();
ContainerName := 'poclosure';
StorageAccount := PurchPayableSetup."Storage Account Name";
SharedKey := PurchPayableSetup."Access Key";
Authorization := StorageServiceAuth.CreateSharedKey(SharedKey);
ABSBlobClient.Initialize(StorageAccount, ContainerName, Authorization);
TempBlob.CreateOutStream(OutStr);
if XMLPORT.Export(50008, OutStr, ClosedPO) then begin
TempBlob.CreateInStream(Ins);
CopyStream(OutStr, Ins);
ABSBlobClient.PutBlobBlockBlobStream('Closed PO List: ' + format(CurrentDateTime), Ins);
InsertLogEntry('Export', 'XML File Export Successfully ');
end;
END;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions