C# Fax – Get List of Submitted Faxes
25 Nov 2016 This code sample is deprecated and in process of being removed. Check out our new code libraries and usage documentation on InterFAX @ Github.
Download the C# fax API zip file.
In this sample, you retrieve a list of submitted (inbound) C# faxes using the GetList method.
The C# fax API snippet below demonstrates the use of the inbound Web service’s GetList method, and returns information for a number of submitted faxes:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GetList
{
class Program
{
static void Main(string[] args)
{
string username = "";
string password = "";
int maxItems = 100;
interfax.MessageItem[] inboundReceivedFax = null;
interfax.Inbound interfaxWebServiceInbound = new interfax.Inbound();
long resultStatus = interfaxWebServiceInbound.GetList(username, password, interfax.ListType.NewMessages, maxItems, ref inboundReceivedFax);
if (resultStatus == 0) // no errors while running GetList
{
if (inboundReceivedFax != null) // there were results
{
for (int i = 0; i <= inboundReceivedFax.Length - 1; i++)
{
Console.WriteLine(string.Format("MessageID: {0}. Size (in bytes): {1}", inboundReceivedFax[i].MessageID, inboundReceivedFax[i].MessageSize));
// lists inbound fax Transaction IDs and the size of the faxes
}
}
else
{
Console.WriteLine(string.Format("No Results for provided Parameters, please review."));
// no results
}
}
else
{
Console.WriteLine(string.Format("Failed with Error Code {0}", resultStatus));
// error
}
Console.ReadLine(); // use this to keep console open (waiting for keypress) after it is finished
}
}
}