Search code examples
azure-blob-storagedynamics-business-central

Renaming the blob storage file


I have a problem with changing the name because as you can see in the code below I download the blob by name but this name is an identifier I would like the name to be changed to the name that is stored in the database and the blob to have the identifier

area(Processing)
    {
        action(Download)
        {

            ApplicationArea = All;
            Caption = 'Download';
            Image = Download;

            trigger OnAction();

            begin

                ABSBlobClient.GetBlobAsFile(Rec.BlobName);
            end;
        }
    }

whether it can be done at all and how because this getblobasfile method is systemic and I cannot modify it


Solution

  • I used takeigo for this and it works

    begin
        ABSBlobClient.GetBlobAsStream(Rec.BlobName, ToFile);
        file.DownloadFromStream(ToFile, '', '', '', Rec.Name);
    end;