Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Automate XML File push to Azure Blob Storage on 'Export' Action Without Saving Locally

Posted on by 150

On the payment journal page, there is an action (EXPORT) that, when clicked, generates an XML file and stores it on the local system. I want to transfer this file directly to Azure Blob Storage. When I click on the "Export" action, the file should be transferred to Azure Blob Storage instead of being stored locally. I wanted to store it in the azure blob storage using API and SAS token. cause after i have to apply encryption and decryption logic as well.

Is it possible to achieve this using code? I don't want to use Power Automate or any other flow. How can I do this?

  • user 123 Profile Picture
    user 123 150 on at
    Automate XML File push to Azure Blob Storage on 'Export' Action Without Saving Locally
    Could you please elaborate it?
  • Suggested answer
    GL-20110726-0 Profile Picture
    GL-20110726-0 2 on at
    Automate XML File push to Azure Blob Storage on 'Export' Action Without Saving Locally
    Yes, I have it working in BC24:
     
    The steps is as simple as something like this:
    1. Initialize ABSBlobClient
        var Codeunit System.Azure.Storage."ABS Blob Client";
              StorageServiceAuthorization: Codeunit System.Azure.Storage."Storage Service Authorization";
        ABSBlobClient.Initialize(StorageAccount, ContainerName, StorageServiceAuthorization.UseReadySAS(SAS))
     
    2. Store InStream_ to Blob with PathAndFileName:
        var ABSOperationResponse: Codeunit System.Azure.Storage."ABS Operation Response";
        ABSOperationResponse := ABSBlobClient.PutBlobBlockBlobStream(PathAndFileName, InStream_);
            if not ABSOperationResponse.IsSuccessful() then
              Error(....
       
    Best regards
    Gert Lynge 

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 Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

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... 290,990 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,656 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans