I want to unzip and extract from a password-protected file using SSIS. I do not want to use any third-party applications and therefore I used script task. I am able to extract if there is no password on the file, however, don't know about password parameter in the same.
I am using the .NET 4.5 framework, with System.IO.Compression and System.IO.Compression.FileSystem, System.IO references added.
This is what works without password:
string ZipFullPath = Dts.Variables["User::FullPathtoZip"].Value.ToString();
string inputfolder = Dts.Variables["User::TargetFolder"].Value.ToString();
using (ZipArchive arch = ZipFile.OpenRead(ZipFullPath))
{
foreach(ZipArchiveEntry entry in arch.Entries)
{
entry.ExtractToFile(Path.Combine(inputfolder, entry.FullName));
}
}
File.Delete(ZipFullPath);
Can someone please tell me how I can add a password parameter to the same? New to C#.