@andrzej.kniola provided steps to do this here but I can’t seem to get the class to unzip a file. I’ve looked at This .Net library but I can’t this get to work.
Can you guys please point me in the right direction?
here is the .XAML Two assigns and an invoke method. I also added <x:String>System.IO.Compression</x:String> to the XAML file.
I’m opening your workflow and I get this warning 'ZipFile' does not have a public static method named 'ExtractToDirectory' matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod.
Basically you’re trying to call ZipFile.ExtracttoDirectory() instead of ZipFile.ExtractToDirectory(zipFile, extractPath)
After setting the parameters (zipPath, extractPath) for the ExtractToDirectory method it will work.
It should work when you’ll set the params, although I have to say that making dedicated activities for Zip/Unzip made our life much easier, especially for less technical designers - it’s easy to miss something when it’s hidden in Invoke’s params, but much clearer when you have it directly in Properties.
So in the end I’d definitely recommend adding some Custom activities - it’s a good way to practice too
Yeah, yeah, it worked. Thank you @badita and @andrzej.kniola… to have you both helping me with this was like having two golden globe nominees on the stage…
@andrzej.kniola… so you are sayin’ that is better to use this custom activity or to create something more like the unzip activity with VB, and nupackage and all that kind of stuff?
Here is the .XAML for everyone’s usage. unzip.xaml (5.8 KB)
If it’s a one-off usage, go with the .xaml as you have. But if you’ll need this functionality in multiple projects (with Zip/Unzip it’s a pretty good guess that you’ll use it in different places) or if you’ll be zipping a lot of files, I’d definitely go with a compiled CodeActivity (.dll packed to a .nupkg).
I’d go with these questions when thinking about creating a custom CodeActivity:
Will it be used in multiple projects or in many places across a project?
Are arguments enough to fully use the activity?
Is the operation fully encapsulated within?
Is the operation straightforward enough to be understandable without the verbosity of a workflow?
Is speed of execution important? (compiled code is faster, as a rule of thumb)
Is it easier/more readable to do it from code?
Is the functionality relatively static, as in it won’ need to change often?
If you answer Yes to most of them, it’s a good candidate. It can still vary case-by-case, but usually for simple utility code (zip/unzip, read/write, data parsing etc.) it’s a one-and-done job to make an activity which you won’t need to worry about later.
Sooner or later you will probably need a custom activity for something, might as well get to know how to build them on the easy stuff.
Hi
Can i know the exact target type as in System.IO.Compression there are other subcategores also which to select for this i am not getting…please help
in this example
After you add the System.Io.Compression you can browse the library
System.IO.Compression.ZipFile under the TargetType Property of the Invoke Method Activity
IF you still dont see it try restarting Studio.
Else try using the XAML that was posted from one of the users above.
Here I have attached the sample for you that to extract the same name.
If you have different name of file Inside the zip file , you can rename it after extract the zip file by using File rename.