Hi,
we have business central 15 and I wanted to bulk export items pictures at a time and below is my code. It doesn't download any zip file.
if ItemCode = '' then
error('Add item filter');
MyItem.SetFilter("No.", '%1', ItemCode);
ZipFileName := 'Picture.zip';
datacompresion.CreateZipArchive();
repeat
with MyItem do begin
if Picture.Count > 0 then begin
ItemCnt := ItemCnt + 1;
for Index := 1 to Picture.Count do begin
PicCount := PicCount + 1;
FileName := '';
if TenantMedia.Get(Picture.Item(Index)) then begin
TenantMedia.calcfields(Content);
if TenantMedia.Content.HasValue then begin
FileName := "No." + '-' + format(Index) + GetTenantMediaFileExtension(TenantMedia);
TenantMedia.Content.CreateInStream(PicInstream);
datacompresion.AddEntry(PicInStream, FileName);
end;
end;
end;
end;
end;
until MyItem.Next() = 0;
Message('Items processed ' + Format(ItemCnt) + ' Pictures processed ' + Format(PicCount));
blobStorage.CreateOutStream(ZipOutStream);
datacompresion.SaveZipArchive(ZipOutStream);
datacompresion.CloseZipArchive();
blobStorage.CreateInStream(ZipInStream);
DownloadFromStream(ZipInStream, 'Download zip file', '', '', ZipFileName);
I tried to fix the solution mentioned in the below link, but no zip file is downloaded.
does anyone has any idea why it is not working.