Due to scheduled maintenance, some areas of our site are currently inaccessible. Thank you for your patience.

Please reach out to sales@eonesolutions.com with any questions.


SmartConnect – Zip File as Source

Published: Apr 10, 2019
Post Author Written by eOne Solutions

Using a Zip file as a SmartConnect Source

By default, we can’t use a zip file within SmartConnect as a data source directly, however we can write a pre-map script to extract the contents of the zip file.

This article is for the on-premise version of SmartConnect only and has only been verified with SmartConnect 20.18 and newer.


Script Namespaces

To begin, we need to add some .NET script namespaces to SmartConnect that will be used within our script. Unfortunately, the standard Script Namespace User window can’t be used for the System.IO.Compression assemblies that we need, so we’ll insert them directly into the proper SQL table.

These will insert into the ScriptNamespace table in the SmartConnect database. Be sure to change to the proper database name if not using the default name.

INSERT INTO SmartConnect..ScriptNamespace

SELECT ‘System.IO.Compression’, ‘System.IO.Compression’, 0


INSERT INTO SmartConnect..ScriptNameSpace

SELECT ‘System.IO.Compression.FileSystem’, ‘System.IO.Compression.FileSystem’, 0


After inserting these into our SQL table, be sure to restart SmartConnect.



Pre-Map Script

Create a pre-map script to get the zip file and copy the contents, most likely to another folder that would be your data source folder. 

If the filename is known, it can be hard coded as below and extracted to a folder.




System.IO.Compression.ZipFile.ExtractToDirectory(@”C:eOneZipFiledownloadsfilename.zip”, @”C:eOneZipFileSource”)


If the zip file is going to be different each time, then it would require looping through the directory to find the file and extract it. This would also work if there are multiple zip files in the same directory when the map is run.


Dim extractPath as string = “C:eOneZipFileSource”

Dim files() as string = DirectoryInfo.GetFiles(“C:eOneZipFileDownloads”,”*.zip”)


For Each file as string in files



  Return true



string extractPath = @”C:eOneZipFileSource”;

string[] files = DirectoryInfo.GetFiles(@”C:eOneZipFileDownloads”, “*.zip”);


foreach (string file in files)

System.IO.Compression.ZipFile.ExtractToDirectory(file, extractPath);

return true;




Set up the map using the Folder Data source using the Source Folder that is referenced in your pre-map script. All the extracted files will then exist in this folder and those that match the template format will be properly processed.


Feeling stuck? Get the support and guidance you need to help you power through any data challenge

We're on your integration team. Connect with our people and let us know how we can help you.