I'm able to send a fax through the COM library FaxComLib (Add Reference -> COM tab -> faxcom 1.0 Type Library) and the fax goes through successfully.
My problem is that while I can send a fax, I can't seem to get an accurate status back from the fax queue. The QueueStatus property of the FaxJob object always returns "Pending."
The environment: Windows 2003 R2 Enterprise w/SP2 -- have also tried on Windows 2008 R2 with same results
Here's my prototype code:
public void GetFaxStatus(int queueNum)
{
FaxServer faxServer = new FaxServer();
faxServer.Connect("myfaxservername");
bool isInQueue = false;
FaxJobs faxJobs = (FaxJobs)faxServer.GetJobs();
for (int i = 1; i <= faxJobs.Count; i++)
{
FaxJob j = (FaxJob)faxJobs.Item[i];
MessageBox.Show(faxJobs.Item[i].GetType().ToString() + "\r\n" + CreateStatus(j));
if (j.JobId == queueNum)
{
MessageBox.Show("Found Job:\r\n" + CreateStatus(j));
isInQueue = true;
}
}
if (isInQueue == false)
{
MessageBox.Show("Fax is no longer in queue.(...or does not exist)");
}
faxServer.Disconnect();
}
static string CreateStatus(FaxJob job)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(string.Format("Billing Code: {0}", job.BillingCode));
sb.AppendLine(string.Format("Device Status: {0}\r\n", job.DeviceStatus));
sb.AppendLine(string.Format("Queue Status: {0}", job.QueueStatus));
sb.AppendLine(string.Format("Display Name: {0}", job.DisplayName));
sb.AppendLine(string.Format("Fax Number: {0}", job.FaxNumber));
sb.AppendLine(string.Format("Job Id: {0}", job.JobId));
sb.AppendLine(string.Format("Tsid: {0}", job.Tsid));
sb.AppendLine(string.Format("Type: {0}", job.Type));
sb.AppendLine(string.Format("Page Count: {0}", job.PageCount));
return sb.ToString();
}
When I run it for a job that has failed (retry limit was exceeded), I get this:

That is the only status I ever get for any fax job; in any status. Am I doing something wrong? Have I configured the fax server wrong? Can you shed any light on my problem for me?
Thanks. -Jason
for loopshowing how to enumerate over FaxJobs saved me! MSFT documentation sux btw. - FleaFaxJobclass does give very limited information. I want to get the Fax Submission time, No. of Retries, is there any where I could get it? - hiFI