VB Fax – Get a List of Received Faxes with VB6

Download the VB fax (VB6) code samples.

In this VB fax sample, the GetList2 method is used to retrieve a list of inbound faxes (received faxes) with VB6.

The code snippet below uses the GetList2 method to display details for a number of submitted VB faxes (VB6):


Attribute VB_Name = "GetList2"
'
' This method gets a list of received VB6 faxes from the Inbound queue.
' A typical usage would be:
' ~ retrieve a list of all only new (yet Unread) items.
' ~ Browse the list and for each item on it:
'       Fetch the Image (tiff or pdf) using the GetList2() method
'       Mark each retrieved item as 'Read' using the MarkMessage() method
'
Option Explicit

Const TransactionID As Long = 0   'All Transactions; Specify ID to get it

Public Sub Invoke()

Dim objEnv As PocketSOAP.CoEnvelope
Dim objHttp As PocketSOAP.HTTPTransport

Set objEnv = New PocketSOAP.CoEnvelope

objEnv.EncodingStyle = ""

objEnv.SetMethod "GetList2", "https://www.interfax.net"
objEnv.Parameters.Create "Username", Main.Username, objEnv.URI
objEnv.Parameters.Create "Password", Main.Password, objEnv.URI
' Start a QueryForm
Dim QF As PocketSOAP.CoSoapNode
Set QF = objEnv.Parameters.Create("QueryForm", Empty, objEnv.URI)
QF.Nodes.Create "TransactionID", TransactionID, objEnv.URI
QF.Nodes.Create "UserID", "", objEnv.URI 'query about me as a user
QF.Nodes.Create "OnlyNewMessages", True, objEnv.URI 'Messages that are not marked as 'read'

Dim RT As PocketSOAP.CoSoapNode
Set RT = QF.Nodes.Create("RecieveTime", Empty, objEnv.URI)  'Head of block
RT.Nodes.Create "Verb", "", objEnv.URI 'query about me as a user
RT.Nodes.Create "VerbData", "", objEnv.URI 'query about me as a user

Dim QC As PocketSOAP.CoSoapNode
Set QC = objEnv.Parameters.Create("QueryControl", Empty, objEnv.URI)
QC.Nodes.Create "MaxChunkSize", 10000, objEnv.URI
QC.Nodes.Create "FromRecordNumber", 0, objEnv.URI

Set objHttp = New PocketSOAP.HTTPTransport
objHttp.SOAPAction = "https://www.interfax.net/GetList2"
objHttp.send "https://ws.interfax.net/Inbound.asmx", objEnv.Serialize
objEnv.parse objHttp

Dim Result As PocketSOAP.CoSoapNode
Set Result = objEnv.Parameters.Item(0)

Dim ResultCode As PocketSOAP.CoSoapNode
Set ResultCode = Result.Nodes.itemByName("ResultCode", objEnv.URI)
MsgBox "ResultCode=" & ResultCode.Value

Dim TotalTransactionsNum As PocketSOAP.CoSoapNode
Set TotalTransactionsNum = Result.Nodes.itemByName("TotalTransactionsNum", objEnv.URI)
Dim n As Integer: n = TotalTransactionsNum.Value
MsgBox "TotalTransactionsNum=" & n & " (showing first 5)"
If n > 5 Then n = 5

Dim i As Integer, j As Integer
If n > 0 Then
    Dim MessageItems As PocketSOAP.CoSoapNode
    Set MessageItems = Result.Nodes.itemByName("MessageItems", objEnv.URI)
    MsgBox "Items: " & MessageItems.Nodes.Count
    Dim MessageItem2 As PocketSOAP.CoSoapNode
    Dim strOut As String
    For i = 0 To n - 1
        Set MessageItem2 = MessageItems.Nodes.Item(i)
        strOut = ""
        For j = 0 To MessageItem2.Nodes.Count - 1
            strOut = strOut & MessageItem2.Nodes.Item(j).Name & ": " & MessageItem2.Nodes.Item(j).Value & vbCrLf
        Next
        MsgBox strOut
    Next
End If

Set objEnv = Nothing
Set objHttp = Nothing

End Sub