Instructions
- Create a new Console Application project and add a web reference
- Copy the entire code below, delete anything written in your application and paste the code there
- Replace "MyUsername" and "MyPassword" with your PostalMethods user details
- Replace "IDs" with a single ID of one of your sent mail items, multiple IDs (ID1,ID2,ID3) or a range of IDs (ID1-ID2)
- Start your application. If the response is -3000, you will see the details 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" 'To query a single mail item
'Const IDs As String = "0,0,0" 'To query multiple mail items
'Const IDs As String = "0-0" 'To query a range of mail items
Dim objPM As New com.postalmethods.api.PostalWS()
Dim WSResult As com.postalmethods.api.GetDetailsExtendedResult
'
' Invoke the GetLetterDetails method
'
WSResult = objPM.GetDetailsExtended( _
MyUsername, _
MyPassword, _
IDs)
'
' Check response status
'
If WSResult.ResultCode = -3000 Then
'
' -3000 means that the data was successfully retrieved.
'
For i As Integer = 0 To WSResult.Details.Length - 1
With WSResult.Details(i)
Console.WriteLine("ID: {0}", .ID)
Console.WriteLine("Status: {0}", .Status)
Console.WriteLine("Status Description: {0}", .StatusDescription)
Console.WriteLine("Completion Time: {0}", .CompletionTime)
Console.WriteLine("Is Batch: {0}", .IsBatch)
Console.WriteLine("Mailer Type: {0}", .MailerType)
Console.WriteLine("MyDescription: {0}", .MyDescription)
Console.WriteLine("Num Of Sheets: {0}", .NumOfSheets)
Console.WriteLine("Price: {0}", .Price)
Console.WriteLine("SubmitTime: {0}", .SubmitTime)
Console.WriteLine("Work Mode: {0}", .WorkMode)
Console.WriteLine("Print Color: {0}", .PrintColor)
Console.WriteLine("Print Sides: {0}", .PrintSides)
Console.WriteLine("Postcard: {0}", .Postcard)
Console.WriteLine("Envelope: {0}", .Envelope)
Console.WriteLine("Orientation: {0}", .Orientation)
Console.WriteLine("Paper: {0}", .Paper)
Console.WriteLine("International Mailing: {0}", .InternationalMailing)
Console.WriteLine("National Mailing: {0}", .NationalMailing)
Console.WriteLine("===============================================")
End With
Next
Else
'
' A value less than -3000 means an error occurred.
' See the PostalMethods Status Codes: http://www.postalmethods.com/statuscodes.
'
Console.WriteLine("Error is: " & WSResult.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")
Console.ReadLine()
End Sub
End Module