Expand my Community achievements bar.

Can I Attach Through ASP or get from a DB


Former Community Member
Good Day

My question is: I'm initiating a task through ASP page, can I attach some files when I begin the task through the same ASP?

Or if anybody know if I can read any attachment from a database it will be helpfull also. I'm uploading the files to a database and if I knew how to retrive it from there it will have the same effect


1 Reply


Former Community Member

You can read attachments from a database. What DBMS are you using (MS SQL Server? Oracle? Other?)? The documentation of the db should include explanations for such things, or if you are using ADO, look for GetChunk method in the ADO help file (or at MS website if you do not have the help file locally.)

Once you have the attachment in a local object contained in the ASP Script, you can use the ASP to include attachments in your initiate script. Look at the help file for WFServer API to locate it. You will need to create an attachment object, load the attachment into it, and include it into the workitem object prior to submitting it.

Here is a piece of sample code I have used (once I loaded the file up - altough I did not do that from a database, so that would not be useful for you):

var shandle = wid.Begin( refID, odata );

// Sequentially reference the files.

datatest.LoadFromFile(fileDirectory + fileName +i+ ".pdf");

wid.AddAttachment(shandle, "Document.pdf", 1, datatest );

// Launch a workflow for each of the above files.

wid.Complete(shandle, "Submit" );

Hope this helps,