Solved

Create zip file

  • 4 January 2024
  • 1 reply
  • 45 views

Userlevel 4
Badge +1

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

icon

Best answer by Leonardo Justiniano 4 January 2024, 16:12

View original

1 reply

Userlevel 6
Badge +4

Hi @stephenward03 

 

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

 

Cheers!

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved