Equisys technical notes

Technical guidance, explanations and fixes for our products

INFO: Common Programming Problems with the COM API

Print

ZTN1273

ID: ZTN1273

This Zetafax technical note applies to:

  • 7.5.0.65 or later

Summary

This technical note lists some common problems encountered when using the COM API and gives information on how to solve them.

More information

Q. I am adding an attachment to a NewMessage object with NewMessage.Attachments.Add, but when I send the fax it fails with the error "Can't open graphics file < filename> ".

The "Attachments" collection refers to Zetafax public/private attachments, and not attached files. To attach a file you should use the NewMessage.Files collection. i.e. the line:

oNewMessage.Attachments.Add(" c:\arbitrary.bmp" )

Should be changed to:

oNewMessage.Files.Add(" c:\arbitrary.bmp" )

Q. I have used the "Send Fax" sample code shipped with the COM API and I get the error "Object does not support this property or method".

There is a mistake in the sample code shipped with the COM API. The line:

Set oNewMessage = oZfAPI.CreateNewMsg

Should read:

Set oNewMessage = oUserSession.CreateNewMsg

Q. Once I have sent a fax using NewMessage.Send how do I track the status of the message?

This cannot be done with version 7.5 of the COM API. You therefore have two options:

  1. Upgrade to Zetafax 8. Version 8 of the COM API has a NewMessage.Body property which, after the message has been sent, contains the message body of the fax. This allows you to identify the message as follows:
  2.  

    Dim oZfAPI As New ZfLib.ZfAPI

    Dim oUserSession As ZfLib.UserSession

    Dim oNewMessage As ZfLib.NewMessage

    Dim oOutbox As ZfLib.Outbox

    Dim oMsg As ZfLib.Message

    ' Logon and create NewMessage:

    Set oUserSession = oZfAPI.Logon(" HHUNTER" , False)

    Set oNewMessage = oUserSession.CreateNewMsg

    ' Set properties:

    oNewMessage.Recipients.AddFaxRecipient " Sam Smith" , _

                                           " ACME plc" , " 020 7123 4567"

    oNewMessage.Text = " I am a fax!"

    oNewMessage.Subject = " I am a subject"

    ' Send!

    oNewMessage.Send

    ' Get Status of new message

    Set oOutbox = oUserSession.Outbox

    Set oMsg = oOutbox.GetMsg(oNewMessage.Body)

    MsgBox oMsg.GetMsgInfo.Subject

     

  3. Use the C API.  The function ZfxSendSubmitFile's final parameter is a buffer which contains the message body name of the fax if it was successfully submitted for sending.

References

ZTN1240-INFO: Zetafax COM API FAQ

Last updated: 07 April 2003 (AG/DH)

Equisys Logo, Document Management and Expense Management for Business Central
 

Replaced by script