By using the Automation “‘Microsoft Shell Controls And Automation’.Shell” you can unzip a file within Dynamics NAV.
Create a Global
Name | DataType | Subtype |
SystemShellControl | Automation | ‘Microsoft Shell Controls And Automation’.Shell |
SystemShellItem | Automation | ‘Microsoft Shell Controls And Automation’.FolderItem |
SystemShellItems | Automation | ‘Microsoft Shell Controls And Automation’.FolderItems |
FileName | Text | |
ZipFileName | Text | |
DestFolderName | Text | |
Index | Integer | |
Pos | Integer |
And then simply
[code]ZipFileName := ‘C:\TEMP\ZipFile.Zip’;
DestFolderName := ‘C:\TEMP\’;
SystemShellItems := SystemShellControl.NameSpace(ZipFileName).Items;
SystemShellControl.NameSpace(DestFolderName).CopyHere(SystemShellItems);
FOR Index := 1 TO SystemShellItems.Count DO BEGIN
SystemShellItem := SystemShellItems.Item(Index – 1);
IF ISSERVICETIER THEN
FileName := SystemShellItem.Path
ELSE
FOR Pos := 1 TO STRLEN(SystemShellItem.Path) DO
IF COPYSTR(SystemShellItem.Path,Pos,1) = ‘\’ THEN
FileName := COPYSTR(SystemShellItem.Path,Pos + 1);
// Do what ever you whant to DestFolderName + FileName
END;[/code]