I was able to sund a fax using the code from https://apiforums.easylink.com/content/c-jobsubmit-fax-single
this code sends a single fax file per submission.
how can I send multiple files with one submission
please advise
Thanks
Are you trying to send a single fax to multiple destinations, or multiple files to a single destination?
multiple files to a single destination
thanks
To add additional documents to your fax, you need to create additional documents and assign them a treatment of "attachment".
So it would look something like this:
//// Existing Sample Code
//// Setup Document 1 - PDF File = ReadAndEncodedFile("mypdf.pdf"); DocData.format = Fax.EMsgAPI_JobSubmit201101.DocEncodingFormat.base64; DocData.Value = File; JS_Documents[0].Item = DocData; Fax.EMsgAPI_JobSubmit201101.EncodableStringType myFileName = new Fax.EMsgAPI_JobSubmit201101.EncodableStringType(); myFileName.Value = "PDF_File.pdf"; JS_Documents[0].Filename = myFileName; JS_Documents[0].DocType = "PDF"; JS_Documents[0].ItemElementName = Fax.EMsgAPI_JobSubmit201101.ItemChoiceType.DocData; JS_Documents[0].@ref = "Doc1"; DocData = null;
//// New code for additional document
//// Setup Document 2 - PDF File = ReadAndEncodedFile("mypdf2.pdf"); DocData.format = Fax.EMsgAPI_JobSubmit201101.DocEncodingFormat.base64; DocData.Value = File; JS_Documents[1].Item = DocData; Fax.EMsgAPI_JobSubmit201101.EncodableStringType myFileName = new Fax.EMsgAPI_JobSubmit201101.EncodableStringType(); myFileName.Value = "PDF_File2.pdf"; JS_Documents[1].Filename = myFileName; JS_Documents[1].DocType = "PDF"; JS_Documents[1].ItemElementName = Fax.EMsgAPI_JobSubmit201101.ItemChoiceType.DocData; JS_Documents[1].@ref = "Doc2"; DocData = null;
// Existing Sample code
// Setup references to documents JS_Content[0].Item = "Doc1"; JS_Content[0].Treatment = Fax.EMsgAPI_JobSubmit201101.TreatmentType.body; JS_Content[0].TreatmentSpecified = true;
// new code for additional document
// Setup references to documents JS_Content[0].Item = "Doc1"; JS_Content[0].Treatment = Fax.EMsgAPI_JobSubmit201101.TreatmentType.attachment; JS_Content[0].TreatmentSpecified = true;
I'm not sure the above code will compile and work as is, but it should give you an idea of how to do it.
Thanks for your response , I did that and now I get in this line
jsResult = em.JobSubmit(jsRequest);
"The operation has timeout"
// Setup Documents var jsDocuments = new DocumentType[fax.FaxOutgoingFiles.Count]; int count = 0; foreach (var faxFile in fax.FaxOutgoingFiles) { // Setup reusable variables for the document var docData = new DocDataType(); jsDocuments[count] = new DocumentType();
//// Setup Document 1 - PDF string file = ReadAndEncodedFile(faxFile.FileName); docData.format = DocEncodingFormat.base64; docData.Value = file;
jsDocuments[count].Item = docData; var myFileName = new EncodableStringType { Value = faxFile.FileName }; jsDocuments[count].Filename = myFileName; jsDocuments[count].DocType = faxFile.FileName.EndsWith("pdf") ? Utilities.DocTypePdf : Utilities.DocTypeTiff; jsDocuments[count].ItemElementName = ItemChoiceType.DocData; jsDocuments[count].@ref = "Doc" + count; docData = null;
count = count + 1; }
I even rollback the code to the one that was working and now I received "
The "Processing is blocked" message is unrelated to your software - it indicates a possible issue with the system.
Are you submitting to the test system (test2messaging.easylink.com) or production (messaging.easylink.com)?
Also, if you can provide the user ID or email address you are using to authenticate, we might be able to find your requests to see why they timed out.
I was able to submit after several testing , I even received a job id but I did not receive the faxes i sent
aasis
jobid = test2:2914397
Thanks for providing your JobId - that allowed me to easily find your information.
The job did not process because it is missing a document with a treatment of "body" - each job must have at least one "body" document. In this case, the only document that was included has a treatment of "attachment".
If you want to include multiple documents as noted above, the first one must have a Treatment of "body", and all others should have a Treatment of "attachment".
Another approach is to always include an empty document as the "body" (give it a DocType of "empty"), and then all of your regular documents can be "attachment"s.
then should I include this code inside the loop?
var jsContent = new ContentPartType[1];
jsContent[0] = new ContentPartType
Item = "Doc1",
Treatment = TreatmentType.attachment,
TreatmentSpecified = true
I was able to send a fax with multiple files successfully!!