Advertisements

Zip/Un-Zip files using 7Zip

Dear friends today I am sharing functionality created in Navision which can be used to zip or Un-Zip files. Upon request of one of follower of my blog I decided to discuss on this point.

Here below I present below how we can do the same. The variables, functions and process is self-explanatory.

Step 1: Let us create a Setup Table and Page

Zip-UnZip-1

Zip-UnZip-2

Zip-UnZip-3

Step 2: Let us define variables

Zip-UnZip-4

Name                                                    DataType             Subtype                    Length

netProcess                                         DotNet                 System.Diagnostics.Process.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

netProcessStartInfo                       DotNet System.Diagnostics.ProcessStartInfo.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

netProcessWindowStyle              DotNet System.Diagnostics.ProcessWindowStyle.’System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′

ImportPath                                         Text                                                        1024

ExportPath                                         Text                                                         1024

ZipPath                                                 Text                                                        1024

ImportExportSetup                         Record                  Import Export Setup

Order                                                    Text                                                          1024 

Step 3: Let us create a Function to Get Information of Path from Setup:

Zip-UnZip-5

This function is to initialize all the required variables which will be used in other functions.

It takes value from the Setup created above to store path of required folders. 

Step 4: Let us create a Function for running Shell Command for 7zip Files:

Zip-UnZip-6

This function runs the shell script in background to Zip or Un-Zip files in specified folder.

Step 5: Let us create a Function to call UnZip file after preparing the Parameters for Command

Zip-UnZip-7

This function prepares the path, Name of File and Argument for the Shell and finally calls the Shell function to run the command in background. At the end of function you will get UnZiped files from the Zip file.

Step 6: Let us create a Function to call Zip file after preparing the Parameters for Command

Zip-UnZip-8

Zip-UnZip-9

This function prepares the path, Name of File and Argument for the Shell and finally calls the Shell function to run the command in background. At the end of function you will get Ziped file which contains the file specified in InclusiveFiles.

This way you can use above functions to Zip / Un-Zip files using 7Zip.

 

Advertisements

Comments are closed.

Important

Most of the contents you find in this blog will be either inherited from MSDN or Navision Developer IT Pro Help. Some places images are also directly taken from these sites. Purpose is simple to try those stuffs and re-produce adding few things as per my understanding to make easy understanding for others and quick reference.

Here nothing under my own brand or authorship of the content. At any point of time we are just promoting Microsoft stuffs nothing personnel with same.

Hope stuffs used here will not violate any copyright agreement with them. In case by mistake or in-intestinally it happens and the Microsoft feels these should not be used Microsoft have full right to inform me about same and will be glad to take down any such content which may be violating the norms.

Purpose is to promote Navision and share with community.

FB Profile

Like FB Page

%d bloggers like this: