2.7.1 Export from Handyman with Visual Basic

Dim oHandyman as ehmInterface.XML
Dim sMyString as string

' Create an interface object
Set oHandyman = CreateObject("ehmInterface.XML")

With oHandyman
  .ClientID = "000" '' Client id for backoffice system

  If .ExportDataReady() then
    ' there are orders in Handyman that are ready to export
    ' do whatever you want

    If .Export() then
      ' the XML results are now ready in XMLOrderList

      sMyString = .XMLOrderList
      ' Use the string in external system here
      ' If every thing is ok in external system,
      ' tell Handyman that the export was successful
      ' this function updates status of all exported orders

      if .... everything is ok then
        .ExportComplete
      else
        ' if anything went wrong, tell Handyman
        .ExportInComplete
      end if

    else
      ' for some reason the export failed, errors are
      ' logged in the Handyman database
      ' The properties ErrorMessage and ErrorNumber will
      ' contain some errors
    End if

  End if
  .Clean ''' cleanup
End with
Set oHandyman = Nothing ''' dispose of object