C# Fax - Get Fax Information with FaxQuery

Download the C# fax API zip file.

This sample shows you how to retrieve information for one or more submitted C# faxes using the FaxQuery method.

The following C# Fax API snippet displays information for a number of submitted faxes:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FaxQuery
{
    class Program
    {
        static void Main(string[] args)
        {
            string username = "";
            string password = "";
            string verb = "EQ";
            string verbData = "546585833";
            int maxItems = 5;
            // just a single item. additional TID for test 546276522
            int resultStatus = 0;
            interfax.InterFax interfaxWebServiceOutbound = new interfax.InterFax();
            interfax.FaxItemEx[] outputResult = interfaxWebServiceOutbound.FaxQuery(username, password, verb, verbData, maxItems, ref resultStatus);
            if (resultStatus == 0)
            {
                if (outputResult != null)
                {
                    Console.WriteLine(string.Format("Request Successfully Completed."));
                    Console.WriteLine(string.Format("Found {0} transactions.", outputResult.Length));
                    for (int i = 0; i <= outputResult.Length - 1; i++)
                    {
                        Console.WriteLine(string.Format("============{0}============", i + 1));
                        Console.WriteLine(string.Format("Username: {0}", outputResult[i].UserID));
                        Console.WriteLine(string.Format("TransactionID: {0}", outputResult[i].TransactionID));
                        Console.WriteLine(string.Format("DestinationFax: {0}", outputResult[i].DestinationFax));
                        Console.WriteLine(string.Format("SubmitTime: {0}", outputResult[i].SubmitTime));
                        Console.WriteLine(string.Format("PostponeTime: {0}", outputResult[i].PostponeTime));
                        Console.WriteLine(string.Format("CompletionTime: {0}", outputResult[i].CompletionTime));
                        Console.WriteLine(string.Format("Duration: {0}", outputResult[i].Duration));
                        Console.WriteLine(string.Format("Subject: {0}", outputResult[i].Subject));
                        Console.WriteLine(string.Format("Reply Email: {0}", outputResult[i].ReplyEmail));
                        Console.WriteLine(string.Format("Sender CSID: {0}", outputResult[i].SenderCSID));
                        Console.WriteLine(string.Format("Remote CSID: {0}", outputResult[i].RemoteCSID));
                        Console.WriteLine(string.Format("Pages Submitted: {0}", outputResult[i].PagesSubmitted));
                        Console.WriteLine(string.Format("Pages Sent: {0}", outputResult[i].PagesSent));
                        Console.WriteLine(string.Format("Status: {0}", outputResult[i].Status));
                        // prints an enumerated list of all transactions found with the query
                    }
                } else
                {
                    Console.WriteLine(string.Format("Incorrect Query"));
                    // one of the parameters for FaxQuery is incorrect
                }
            } else
            {
                Console.WriteLine(string.Format("Error Code {0}.", resultStatus));
            }
            Console.ReadLine(); // use this to keep console open (waiting for keypress) after it is finished
        }
    }
}

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today