我能够通过 COM 库 FaxComLib(添加参考 -> COM 选项卡 ->faxcom 1.0 类型库)发送传真,并且传真成功通过。
我的问题是,虽然我可以发送传真,但我似乎无法从传真队列中获得准确的状态。FaxJob 对象的 QueueStatus 属性始终返回“Pending”。
环境:Windows 2003 R2 Enterprise w/SP2——也曾在 Windows 2008 R2 上进行过尝试,结果相同
这是我的原型代码:
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();
}
当我为失败的作业运行它(超过重试限制)时,我得到了这个:
这是我在任何传真工作中获得的唯一身份;在任何状态。难道我做错了什么?传真服务器是否配置错误?你能帮我解释一下我的问题吗?
谢谢。-杰森