Dear All good day.
I'm on BC on cloud (accordingly I can't use any on-prem procedure)
I have to convert a media file to text in order to push it on out API.
local procedure MEDIAasTXT(): Text
var
DocumentAttachment: Record "Document Attachment";
MediaAsOutStream: OutStream;
begin
DocumentAttachment.SetRange("Table ID", 27);
DocumentAttachment.SetRange("No.", rec."No.");
if DocumentAttachment.FindFirst() then
if DocumentAttachment."Document Reference ID".HasValue then begin
DocumentAttachment."Document Reference ID".ExportStream(MediaAsOutStream);
exit(format(MediaAsOutStream));
end;
end;
Actually
DocumentAttachment."Document Reference ID".ExportStream(MediaAsOutStream);
Leads to "The contents 'Stream provider' of ExportStream parameter number 1 are invalid."
How can I fix it?
Kind regards,
John
0