Code snippet to convert JobID from MS Fax API

Here’s a quick little code snippet which will convert a job ID into the correct format when you’re using the MS faxcomexlib.dll. This is needed because you’ll get different formats back from a ConnectedSubmit depending on whether your application is running on Windows XP or Windows 2003 Server. However, the format does not vary when you get status change events.

        private string ConvertJobID(string jobID)
{
string hexJobId = string.Empty;

try
{
Int64 i = Convert.ToInt64(jobID);
//Match event handler format:
// hex number; lowercase;
// no leading zeroes;
// no "0x" or other prefix
hexJobId = i.ToString("x");
}
catch // If there's an exception,
// then the Job ID is already correct
{
hexJobId = jobID;
}

return hexJobId;
}
 

Technorati tags: , , ,