Skip to content


SmartConnect – Zip File as Source

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:\eOne\ZipFile\downloads\”, “C:\eOne\ZipFile\Source”)


System.IO.Compression.ZipFile.ExtractToDirectory(@”C:\eOne\ZipFile\downloads\”, @”C:\eOne\ZipFile\Source”)


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:\eOne\ZipFile\Source”

Dim files() as string = DirectoryInfo.GetFiles(“C:\eOne\ZipFile\Downloads”,”*.zip”)


For Each file as string in files

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


  Return true



string extractPath = @”C:\eOne\ZipFile\Source”;

string[] files = DirectoryInfo.GetFiles(@”C:\eOne\ZipFile\Downloads”, “*.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.


Unable to convert value to DateTimeOffset when running a Business Central Integration
Archive file cannot be size 0
Downloading older versions of SmartConnect
How to Update the Email Address for an Automatic Payment
How to Purchase SmartConnect


SSL Security error using OLEDB Connection
This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms
Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))
The server process could not be started because the configured identity is incorrect.
Using WINSCP and a task to upload or download files from an SFTP site



Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships Partner All Hands Call Popdock promotions release SalesForce SmartConnect SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.