VB.NET: Get Details Of Uploaded Files Using GetUploadedFileDetails()

Instructions

  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.
  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"
 
        Dim objPM As New com.postalmethods.api.PostalWS()
        Dim WSResult As New com.postalmethods.api.GetUploadedFileDetailsResult
 
        ' Invoke the DeleteUploadedFile method
        WSResult = objPM.GetUploadedFileDetails( _
                                MyUsername, _
                                MyPassword)
 
 
        '
        ' If the result code = -3000, the request was successful.
        '
        If WSResult.ResultCode = -3000 Then
 
            For i As Integer = 0 To WSResult.UploadedFiles.Length - 1
                With WSResult.UploadedFiles(i)
                    Console.WriteLine("File Name: {0}", .FileName)
                    Console.WriteLine("Description: {0}", .Description)
                    Console.WriteLine("Submit Time: {0}", .SubmitTime)
                    Console.WriteLine("Permissions: {0}", .Permissions)
                    Console.WriteLine("Last Usage: {0}", .LastUsage)
                    Console.WriteLine("=============================================")
                End With
            Next
            Console.WriteLine("Total number of files: " & WSResult.UploadedFiles.Length)
            Console.WriteLine("=============================================")
 
        Else
            '
            ' A negative value means an error occurred.
            ' See the PostalMethods Status Codes: http://www.postalmethods.com/statuscodes#webservice.
            '
            Console.WriteLine("An error occurred: " & WSResult.ResultCode.ToString)
        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