Fax VB.NET – Query Submitted Faxes with FaxQuery2

Download the fax VB.NET project files.

This code snippet allows you to query a number of previously-submitted faxes with VB.NET, and display detailed information on these faxes. This is done using the FaxQuery2 method with VB.NET, which provides more advanced querying options than FaxQuery (for more details, see Side-by-Side Comparison of Web Service Methods).

The fax VB.NET snippet below retrieves detailed information about faxes previously submitted to the InterFAX Web service:


Sub Main()
        Dim username As String = "my username"
        Dim password As String = "my password"
        Dim queryForm As New interfax.QueryForm
        queryForm.ParentTransactionID = New interfax.QueryCondition
        queryForm.ParentTransactionID.Verb = interfax.SQLOperatorEnum.Equals
        queryForm.ParentTransactionID.VerbData = "196805130"

        Dim queryControl As New interfax.QueryControl
        queryControl.NumOfResults = 1 ' just a single item
        queryControl.ReturnItems = True
        queryControl.ReturnStats = True

        Dim ifws As New interfax.InterFax()
        Dim result As interfax.FaxQueryResult = ifws.FaxQuery2(username, password, queryForm, queryControl)
        Console.WriteLine("Status is " & result.ResultCode & "; Total number of transactions: " & result.TotalTransactionsNum & "; Returned items: " & result.FaxItems.Length)
    End Sub