G'Day,
I am searching for an example of using FAXCOMEXLib in csharp.
The COM interfaces are documented on msdn.microsoft. com however the
examples are for VB and c++.
Following up on a previous topic, FAXCOMEXLib is not in
FAXCOMEXLib.dll , but rather Interop.FAXCOME XLib.dll
I added a reference to c:\windows\syst em32\fxscomex.d ll to the project,
and it must translate to the above Interop.FAXCOME XLib.dll
I am a little confused about adding a recipient to a fax document.
I have the fax document object, but the recipients member is
read-only?? So there must be another avenue for adding recipients that
I am yet to discover.
Here is my paltry code (based on code in another newsgroup for
FAXCOMLib)
<code>
using System;
using System.IO;
using System.Componen tModel;
using System.Collecti ons;
using System.Runtime. InteropServices ;
using System.Diagnost ics;
using System.Threadin g;
using System.Windows. Forms;
using FAXCOMEXLib;
namespace csFaxComponent
{
public class csFax
{
protected FaxServer ofs = null;
public static void Main()
{
int JobID = 0;
csFax objcsFax = new csFax();
JobID = objcsFax.FaxDoc ument("C:\\Temp \\any file.txt", "911");
}
private int FaxDocument(Str ing TheFile, string faxnumber)
{
int JobID=0;
FAXCOMEXLib.Fax Server faxsrv = new FAXCOMEXLib.Fax ServerClass();
try
{
faxsrv.Connect( "");
//Pick up the new changed document and fax it out.
FAXCOMEXLib.Fax Document faxdoc = new
FAXCOMEXLib.Fax DocumentClass() ;
faxdoc.Body = TheFile;
//Name the document
faxdoc.Document Name = "Fax Transmission";
faxdoc.ReceiptA ddress = "bob@doe.co m";
FAXCOMEXLib.Fax Recipients frs = new
FAXCOMEXLib.Fax RecipientsClass ();
frs.Add(faxnumb er, "John Doe");
faxdoc.Recipien ts = frs;
faxdoc.Connecte dSubmit(faxsrv) ;
}
catch
{
}
finally
{
faxsrv.Disconne ct();
Marshal.Release ComObject(frs);
Marshal.Release ComObject(faxdo c);
Marshal.Release ComObject(faxsr v);
}
return JobID;
}
}
}
</code>
I was able to send a fax using FAXCOM but I could not seem to get a
good status reply.
I will be faxing out several hundred documents generated by a mail
merge and if there is a problem faxing, then we want to fall back to a
printed/posted document. So the status/jobid is important.
Thanks,
Kim Groves
Accidental
I am searching for an example of using FAXCOMEXLib in csharp.
The COM interfaces are documented on msdn.microsoft. com however the
examples are for VB and c++.
Following up on a previous topic, FAXCOMEXLib is not in
FAXCOMEXLib.dll , but rather Interop.FAXCOME XLib.dll
I added a reference to c:\windows\syst em32\fxscomex.d ll to the project,
and it must translate to the above Interop.FAXCOME XLib.dll
I am a little confused about adding a recipient to a fax document.
I have the fax document object, but the recipients member is
read-only?? So there must be another avenue for adding recipients that
I am yet to discover.
Here is my paltry code (based on code in another newsgroup for
FAXCOMLib)
<code>
using System;
using System.IO;
using System.Componen tModel;
using System.Collecti ons;
using System.Runtime. InteropServices ;
using System.Diagnost ics;
using System.Threadin g;
using System.Windows. Forms;
using FAXCOMEXLib;
namespace csFaxComponent
{
public class csFax
{
protected FaxServer ofs = null;
public static void Main()
{
int JobID = 0;
csFax objcsFax = new csFax();
JobID = objcsFax.FaxDoc ument("C:\\Temp \\any file.txt", "911");
}
private int FaxDocument(Str ing TheFile, string faxnumber)
{
int JobID=0;
FAXCOMEXLib.Fax Server faxsrv = new FAXCOMEXLib.Fax ServerClass();
try
{
faxsrv.Connect( "");
//Pick up the new changed document and fax it out.
FAXCOMEXLib.Fax Document faxdoc = new
FAXCOMEXLib.Fax DocumentClass() ;
faxdoc.Body = TheFile;
//Name the document
faxdoc.Document Name = "Fax Transmission";
faxdoc.ReceiptA ddress = "bob@doe.co m";
FAXCOMEXLib.Fax Recipients frs = new
FAXCOMEXLib.Fax RecipientsClass ();
frs.Add(faxnumb er, "John Doe");
faxdoc.Recipien ts = frs;
faxdoc.Connecte dSubmit(faxsrv) ;
}
catch
{
}
finally
{
faxsrv.Disconne ct();
Marshal.Release ComObject(frs);
Marshal.Release ComObject(faxdo c);
Marshal.Release ComObject(faxsr v);
}
return JobID;
}
}
}
</code>
I was able to send a fax using FAXCOM but I could not seem to get a
good status reply.
I will be faxing out several hundred documents generated by a mail
merge and if there is a problem faxing, then we want to fall back to a
printed/posted document. So the status/jobid is important.
Thanks,
Kim Groves
Accidental
Comment