Skip to main content

Hello, 

I would like to create a processing screen which will check a group of invoices, if an invoice has a file attached then the files will be added to a zip file. The user will download the zip file. 

I’ve found a document which explains how to use zip files in Acumatica, link below:

https://www.acumatica.com/blog/zipped-up-acumatica-manipulating-files-part-1-zip/

It suggests using an object called ZipArchive in the following way 

using (ZipArchive zip = ZipArchive.CreateFrom(zipStream, false))
{
using (MemoryStream fileStream = new MemoryStream())
{
fileStream.Seek(0, SeekOrigin.Begin);

file.Write(fileStream);

fileStream.Seek(0, SeekOrigin.Begin);

zip.AddFile(fileName, fileStream.ToArray());
}
}

I cannot find the ZipArchive type, does anyone know which references and/or ‘using’ statements is required?

The article suggests using PX.Common.Std, I have a reference to this file but I still cannot access ZipArchive.

Thanks

Hi @stephenward03 

 

Try referencing System.IO.Compression.dll in your VS project. 

 

Cheers!

 


Reply