VB.NET: Get The Status Of Multiple Letters with GetLetterStatusV2_Multiple()


  1. Create a new Console Application project and add a web reference.
  2. Copy the entire code below, delete anything written in your application and paste the code there.
  3. Replace the values of the Const lines with your details:
    • Replace MyUsername and MyPassword with your PostalMethods user details.
    • Replace IDs with a comma separated list of LetterIDs for which you would like to get the status.
  4. Start your application. If the response is -3000, you will see the status report. If the response is any other number, check the Web Service Status Codes section.
Imports System.IO
Module Module1
    Sub Main()
        Const MyUsername As String = "MyUsername"
        Const MyPassword As String = "MyPassword"
        Const IDs As String = "0,1,2,3,4"
        Dim objPM As New com.postalmethods.api.PostalWSSimple()
        Dim objResult As com.postalmethods.api.GetLetterStatusV2_MultipleResult
        ' Invoke the GetLetterStatus_Multiple method
        objResult = objPM.GetLetterStatusV2_Multiple(MyUsername, MyPassword, IDs)
        ' Check response status
        If objResult.ResultCode = -3000 Then
            ' -3000 means that the data was successfully retrieved.
            For Each status As com.postalmethods.api.LetterStatusAndDesc In objResult.LetterStatuses
                Console.WriteLine("ID: {0}", status.ID)
                Console.WriteLine("Last update time: {0}", status.LastUpdateTime)
                Console.WriteLine("Status: {0}", status.Status)
                Console.WriteLine("Status description: {0}", status.Description)
            ' A value less than -3000 means an error occurred.
            ' See the PostalMethods Status Codes: http://www.postalmethods.com/statuscodes.
            Console.WriteLine("Error is:" & objResult.ResultCode)
        End If
        ' In debug mode, the following lines prevent your console application from closing automatically upon termination
        Console.WriteLine("Hit ENTER to terminate application")
    End Sub
End Module