Bulk save files attached to attachment
Let's right-click on the project and write it to the reference files
%SystemPath%\Common\eBAPI.dll
%SystemPath%\Common\eBAZipLibrary.dll
Let's add it to the usings above the form
using eBAPI;
using eBAPI.Connection;
using eBAPI.DocumentManagement;
using eBAZipLibrary;
using System.IO;
void zipResponse(string category)
{
using(eBAConnection con = CreateServerConnection())
{
Con. open();
using (Stream zip = new MemoryStream())
{
ZipFile zipfile = new ZipFile();
DMFile flWfd = con. FileSystem.GetWorkflowFile(id);
foreach (DMFileRelation rel in flWfd.GetRelations())
foreach(DMFileContent dmc in flWfd.GetAttachments(category))
{
string name = dmc.ContentName;
zipfile. AddEntry(name, flWfd.DownloadAttachmentContentBytes(category,name));
}
zipfile. Save(zip);
eBAForm f = new eBAForm(id);
WriteToResponse(zip, id.ToString() + " ID li Form Ekleri.zip");
}
}
}
public void Button1_OnClick(Object sender, EventArgs e)
{
string category = "category1"; or TextBox1.Text // We get the category information in the Attachment object
zipResponse(category);
}