I'm trying to get a fax number from IFaxOutgoingJob but keep getting COM error.
FaxServer g_objFaxServer = new FaxServer();
IFaxServer fs = (IFaxServer)g_objFaxServer;
//connection logic...
IFaxOutgoingQueue oq = fs.Folders.OutgoingQueue;
FaxOutgoingJobs jobs = oq.GetJobs();
string fx = "13101230000";
FaxOutgoingMessageIterator iter = oa.GetMessages();
iter.MoveFirst(); //iter = oa oa=>outgoingarchive = already sent
while (!iter.AtEOF)
{
...
if (iter.Message.Recipient.FaxNumber == fx)
{
System.Console.WriteLine("orig sched time: {0}, #: {1}, fn: {2}",
iter.Message.OriginalScheduledTime,
iter.Message.Recipient.FaxNumber,
iter.Message.DocumentName);
}
iter.MoveNext();
}
foreach (IFaxOutgoingJob j in jobs) //jobs=outgoingqueue = to be sent
{
if (j.Recipient.FaxNumber == fx) // <------------possible error?
{
System.Console.WriteLine("orig sched time: {0}, #: {1}, fn: {2}",
j.OriginalScheduledTime,
j.Recipient.FaxNumber,
j.DocumentName);
}
}
I can't really debug in this environment so can't figure out what's going on. Error seems to happen when it's trying to access j.Recipient.FaxNumber because call trace says there's an error, calling IFaxOutgoingJob.get_Recipient().
Side question is FaxOutgoingJob and IFaxOutgoinJob seems to serve the same purpose. Why would one use IFaxOutgoingJob against the other one? I know i is interface but it doesn't really make sense why there are two if they're doing the same thing.
Ok I feel bad about this. I think my code has a flaw.
'jobs' in the second for loop block was the old one that I was reusing and it wasn't being refreshed and that's why it couldn't find it later when some time has passed (in matter of minutes), especially, after a job was sent.