Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Can I Attach Through ASP or get from a DB

Avatar

Not applicable
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



Regards

--Mohammed
1 Reply

Avatar

Not applicable
Mohammed,



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,

Sanna