Sales
Click for numbers
Welcome User Tools Developer Tools Prices Help Sign up Login
You are here: Home > Developer Tools > Fax Web Service > Samples >  C# - Simple Fax Transmission and Status Check

Fax Web Service Code Sample

C# - Simple Fax Transmission and Status Check (SendCharFax & FaxStatus Methods)

Download the C# project file and extract it to a local folder.

2. Using IIS manager, create a virtual directory with the name "Interfax" (without the quotes) pointing to the local folder from [1]. Make sure IIS is running.

You can now use your browser as follows:
http://localhost/Interfax/sfcs.html - to send a fax
http://localhost/Interfax/fscs.html - to get a status

// Send fax
{
long lngReturnCode;

InterFax.InterFax objIF = new InterFax.InterFax();

lngReturnCode = objIF.SendCharFax("MyUserName","MyPassword","1-303-6868686","This is a sample fax from InterFAX Inc.","TXT");

Response.Write("Send Fax returned code is: " + lngReturnCode);
}


// Get status
{
const string strLineBreak = "<BR>";
int iLastTransactionID;
int iMaxItems;
int iTotalCount=0;
int iListSize=0;
int iResultCode=0;
InterFax.FaxItem[] structFaxItems;

iLastTransactionID = Convert.ToInt32(Request.Form["TID"]);
iMaxItems = Convert.ToInt32(Request.Form["MaxItems"]);

InterFax.InterFax objIF = new InterFax.InterFax();
structFaxItems =
objIF.FaxStatus(strUserName,strPassword,
iLastTransactionID,iMaxItems,ref iTotalCount,ref iListSize,ref iResultCode);//get status
if(iResultCode != 0) //error occured

Response.Write("ERROR Occured. Result code is:" + iResultCode);
else //print results
for(int i =0 ; i < iListSize ; i++)
{
Response.Write("=============================" + strLineBreak);
Response.Write("Fax item #" + i + strLineBreak);
Response.Write("TransactionID: " + structFaxItems[i].TransactionID + strLineBreak);
Response.Write("Fax number: " + structFaxItems[i].DestinationFax + strLineBreak);
Response.Write("SubmitTime: " + structFaxItems[i].SubmitTime + strLineBreak);
Response.Write("CompletionTime: " + structFaxItems[i].CompletionTime + strLineBreak);
Response.Write("PagesSent: " + structFaxItems[i].PagesSent + strLineBreak);
Response.Write("Status: " + structFaxItems[i].Status + strLineBreak);
}
}




About | Contact | Privacy | Terms | Partners | Login | System Status

© Interfax Inc