Zip All Files in an Application Database Folder

Tom_R
New Contributor III

Hello, 

I have a sub folder that is being populated each month with a variety of files, it is different from month to month.  The naming convention of the subfolder is consistent.  It is always the fiscal period.  However when I try to zip the files in the folder I am unable to define a path.  

The folder is "Application Database/Documents/Public/" then the fiscal period.  However my code is never able to find it.  I think it is because we are on the cloud.  Any insight on how to define the process for zipping all the files in that folder into one document so it can be sent out through parcel service would be appreciated.

Thanks,

Tom

3 REPLIES 3

JackLacava
Honored Contributor

Hey Tom,

Remember the Application Database repository is not an actual filesystem. Could you post the parts of your code that deal with retrieving files and zipping them, so we can figure out where the problem might be?

Tom_R
New Contributor III

Hi Jack, 

I don't really have code samples. I have been trying to mimic the two samples provided in the Pick-a-csv-file-stored-in-the-DM-Export-in-Filestore-and-covert ticket.  Neither option there has worked for me.  We don't have Zipfile available as part of the system.io, and the XFZip file method is always looking for a folder on the local c:\ which doesn't exist.

Thanks,

Tom

JackLacava
Honored Contributor

Ok, one thing at a time...

First, you should be able to use those .Net libraries, but you have to reference the actual dlls in the rule Properties (and I don't think you'll get any Intellisense support). Here's an example, you might have to ask Support for actual values for your environment:

JackLacava_0-1686601230114.png

Second, the "Application Database" repository is not a real filesystem, but a virtual one that is actually kept in the database. To access files in there, you can use the technique showed here (changing the path): https://community.onestreamsoftware.com/t5/Rules/Documents-Public-location/m-p/13338

Once you have the XFileEx object returned by GetFile, you should be able to retrieve the actual contents as a Byte() array with yourObject.XFile.ContentFileBytes. You can then save that to a physical directory, or (I think) directly with the ZipFile stuff.

Unfortunately this week I cannot put together a sample, maybe someone else will be able to.