Compress files to .zip format

For some reason I don’t see ZipArchive (Compression.FileSystem) class, I’m using 2016.2 , Windows 2012 R2

You need to manually add the reference to System.IO.Compression.FileSystem in the xaml and restart (see post 5 here).
I’m wondering if it’s not loading it correctly though.

Sometimes I’d wish we could just add references to .dll’s without jumping through endless hoops :frowning:


Good tip. Works for me without Invokemethod as the Retrun type is “ZipArchiveEntry”, but unable to open the Zip file.Am i missing something?

Compress.xaml (9.2 KB)


Please ignore, i forgot to dispose the ZipArchive. Works now.

Compress.xaml (9.2 KB)


while running this code getting unauthorized access exception

Hi @sowmya,

That error is maybe because your zipPath is a folder.

You need to assign it the new zip file to be created(ex: “C:\Users\admin\Documents\”).
Then, assign to the filepath variable the folder path to get the files to be compressed(ex: “C:\Users\admin\Documents”).

It should work without errors after doing this.

1 Like

yes its working fine thank you

I want to attach the zip file and send smtp mail how to do this one?

Hello @sowmya,

You could try to use Send SMTP Mail Message activity:


yes we send mail using SMTP but I want attach all the files presented in zip folder dynamically.
files count may change .:frowning:

Hello @sowmya,
Ok, take a look at this:



excelent work

Can you please share your workflow where it worked for you, as i’m trying to do the same but I’m getting unauthorized exception.

Could you please share your workflow

Hi Manjusha,

The workflow is the one shared by Vinay here, i just assigned the zipPath and filepath variables the corresponding paths. Here it is:
Compress.xaml (9.1 KB)

I’m getting compilation error in my xaml file. I imported required namespaces but still no success.

Hi @avi.ngp,

Try System.IO.Path.GetName(file)


Yes It works if We write a file path instead of directory path

or you can use this activity from BalaReva



How can I get this activity?

I searched for it but It doesnt exists