Hi,
I am developing a Fax application using FAXCOMEXLIB in visual studio .net 2005 on Windows XP professional and have come across a strange behaviour. A thread in a class receives the Fax request and the Fax details are filled in and submitted. Note - Even if there are multiple fax numbers i send the FAX one receipient at a time.
For the first fax received the Submit function returns single JOBID. The next FAx submitted returns 2 JObIDs and the third one returns 3 and so on. I thought probably it is holding the previous JOBID and giving it back but that is not the case. I compared all the JOBIDs and they are different. I did convert all these values to decimal and compared and still different.
This is what i get...
Sending 1st Fax..
JOBID - 201c9a0e5136e99
Sending 2nd Fax..
201c9a0e51d7658
201c9a0e51d78c9
Sending 3rd Fax..
201c9a0e52ea797
201c9a0e52eaec3
201c9a0e52ea9e1
The code ..
Class FaxServer
{
private FAXCOMEXLib.Fax Document m_FaxDocument;
private FAXCOMEXLib.Fax Server m_FaxServer;
private FAXCOMEXLib.FAX _SERVER_EVENTS_ TYPE_ENUM FaxSvrEnum;
Public FaxServer()
{
//Constructor..
m_FaxServer = new FAXCOMEXLib.Fax Server();
m_FaxServer.Con nect(Environmen t.MachineName);
m_FaxDocument = new FAXCOMEXLib.Fax Document();
FaxSvrEnum = (FAXCOMEXLib.FA X_SERVER_EVENTS _TYPE_ENUM.fset OUT_QUEUE | FAXCOMEXLib.FAX _SERVER_EVENTS_ TYPE_ENUM.fsetF XSSVC_ENDED);
m_FaxServer.Lis tenToServerEven ts(FaxSvrEnum);
m_FaxServer.OnO utgoingJobAdded += new IFaxServerNotif y_OnOutgoingJob AddedEventHandl er(faxserver_On OutgoingJobAdde d);
m_FaxServer.OnO utgoingJobChang ed += new IFaxServerNotif y_OnOutgoingJob ChangedEventHan dler(faxserver_ OnOutgoingJobCh anged);
}
public void SendFax(FileDet ails objFileDetails)
{
string RecipientName = "";
string FaxNumber = "";
char[] delimiterChars = { ',' };
Common.GetSecti onInfo(objFileD etails.GetMsgFi lePath(), "TO", ref RecipientName); //Get Receipient Name
Thread.Sleep(50 0);
Common.GetLineI nfo(objFileDeta ils.GetMsgFileP ath(), 2, ref FaxNumber); //Get Fax Number
if (RecipientName == "")
{
Log.Info("Recip ient Name missing for File - " + objFileDetails. GetMsgFileName( ));
}
if (FaxNumber == "")
{
//Log that fax number is missing and hence could not be sent..
return;
}
string[] arrFaxNumbers = FaxNumber.Split (delimiterChars );
try
{
foreach (string strFaxNumber in arrFaxNumbers)
{
m_FaxDocument.B ody = objFileDetails. GetTxtFilePath( );
m_FaxDocument.R ecipients.Add(s trFaxNumber, RecipientName);
m_FaxDocument.D ocumentName = objFileDetails. GetMsgFileName( );
Log.Info("Sendi ng Fax for File - " + objFileDetails. GetMsgFileName( ));
//This JobID[0] can be used to store the JobID of the fax job for later reference.
string[] JobIDs = (string [])m_FaxDocument. Submit(null);
//Expecting only 1 JobID as sending Fax to different receipient in a loop..
objFileDetails. SetJobID(JobIDs[0].ToString());
m_dJobIDList.Ad d(JobIDs[0].ToString(), objFileDetails) ;
//Lets save the JOBID in the MSG file properties.
//string fileName = objFileDetails. GetMsgFilePath( ).Substring(Fil eFullPath.LastI ndexOf("\\") + 1);
string fileName = objFileDetails. GetMsgFileName( );
string filePath = objFileDetails. GetMsgFilePath( ).Substring(0, objFileDetails. GetMsgFilePath( ).LastIndexOf(" \\"));
DSOFile.OleDocu mentProperties dso = new DSOFile.OleDocu mentProperties( );
DSOFile.Summary Properties summary;
dso.Open(objFil eDetails.GetMsg FilePath(), false, DSOFile.dsoFile OpenOptions.dso OptionDefault);
summary = dso.SummaryProp erties;
summary.Comment s = string.Join("," , JobIDs);
dso.Close(true) ;
}
}
catch (Exception ex)
{
Log.Error("Exce ption occured while sending Fax for File - " + objFileDetails. GetMsgFilePath( ) + ".Please Investigate." ,ex);
}
}
}
Any clues guys..
I am developing a Fax application using FAXCOMEXLIB in visual studio .net 2005 on Windows XP professional and have come across a strange behaviour. A thread in a class receives the Fax request and the Fax details are filled in and submitted. Note - Even if there are multiple fax numbers i send the FAX one receipient at a time.
For the first fax received the Submit function returns single JOBID. The next FAx submitted returns 2 JObIDs and the third one returns 3 and so on. I thought probably it is holding the previous JOBID and giving it back but that is not the case. I compared all the JOBIDs and they are different. I did convert all these values to decimal and compared and still different.
This is what i get...
Sending 1st Fax..
JOBID - 201c9a0e5136e99
Sending 2nd Fax..
201c9a0e51d7658
201c9a0e51d78c9
Sending 3rd Fax..
201c9a0e52ea797
201c9a0e52eaec3
201c9a0e52ea9e1
The code ..
Class FaxServer
{
private FAXCOMEXLib.Fax Document m_FaxDocument;
private FAXCOMEXLib.Fax Server m_FaxServer;
private FAXCOMEXLib.FAX _SERVER_EVENTS_ TYPE_ENUM FaxSvrEnum;
Public FaxServer()
{
//Constructor..
m_FaxServer = new FAXCOMEXLib.Fax Server();
m_FaxServer.Con nect(Environmen t.MachineName);
m_FaxDocument = new FAXCOMEXLib.Fax Document();
FaxSvrEnum = (FAXCOMEXLib.FA X_SERVER_EVENTS _TYPE_ENUM.fset OUT_QUEUE | FAXCOMEXLib.FAX _SERVER_EVENTS_ TYPE_ENUM.fsetF XSSVC_ENDED);
m_FaxServer.Lis tenToServerEven ts(FaxSvrEnum);
m_FaxServer.OnO utgoingJobAdded += new IFaxServerNotif y_OnOutgoingJob AddedEventHandl er(faxserver_On OutgoingJobAdde d);
m_FaxServer.OnO utgoingJobChang ed += new IFaxServerNotif y_OnOutgoingJob ChangedEventHan dler(faxserver_ OnOutgoingJobCh anged);
}
public void SendFax(FileDet ails objFileDetails)
{
string RecipientName = "";
string FaxNumber = "";
char[] delimiterChars = { ',' };
Common.GetSecti onInfo(objFileD etails.GetMsgFi lePath(), "TO", ref RecipientName); //Get Receipient Name
Thread.Sleep(50 0);
Common.GetLineI nfo(objFileDeta ils.GetMsgFileP ath(), 2, ref FaxNumber); //Get Fax Number
if (RecipientName == "")
{
Log.Info("Recip ient Name missing for File - " + objFileDetails. GetMsgFileName( ));
}
if (FaxNumber == "")
{
//Log that fax number is missing and hence could not be sent..
return;
}
string[] arrFaxNumbers = FaxNumber.Split (delimiterChars );
try
{
foreach (string strFaxNumber in arrFaxNumbers)
{
m_FaxDocument.B ody = objFileDetails. GetTxtFilePath( );
m_FaxDocument.R ecipients.Add(s trFaxNumber, RecipientName);
m_FaxDocument.D ocumentName = objFileDetails. GetMsgFileName( );
Log.Info("Sendi ng Fax for File - " + objFileDetails. GetMsgFileName( ));
//This JobID[0] can be used to store the JobID of the fax job for later reference.
string[] JobIDs = (string [])m_FaxDocument. Submit(null);
//Expecting only 1 JobID as sending Fax to different receipient in a loop..
objFileDetails. SetJobID(JobIDs[0].ToString());
m_dJobIDList.Ad d(JobIDs[0].ToString(), objFileDetails) ;
//Lets save the JOBID in the MSG file properties.
//string fileName = objFileDetails. GetMsgFilePath( ).Substring(Fil eFullPath.LastI ndexOf("\\") + 1);
string fileName = objFileDetails. GetMsgFileName( );
string filePath = objFileDetails. GetMsgFilePath( ).Substring(0, objFileDetails. GetMsgFilePath( ).LastIndexOf(" \\"));
DSOFile.OleDocu mentProperties dso = new DSOFile.OleDocu mentProperties( );
DSOFile.Summary Properties summary;
dso.Open(objFil eDetails.GetMsg FilePath(), false, DSOFile.dsoFile OpenOptions.dso OptionDefault);
summary = dso.SummaryProp erties;
summary.Comment s = string.Join("," , JobIDs);
dso.Close(true) ;
}
}
catch (Exception ex)
{
Log.Error("Exce ption occured while sending Fax for File - " + objFileDetails. GetMsgFilePath( ) + ".Please Investigate." ,ex);
}
}
}
Any clues guys..
Comment