Datasys Knowledge Base Document

Knowledge Base index
Updated: 2000/09/26
Product: FaxChange
Version: 4.0
Service pack: no dependency
Area: API
Category: TIP
Problem: How to send fax from application with all FaxChange send options (scheduling, cover page and so on)

Problem description:

This record describes how to send fax from any aplication using CDO interface - and how to set all of FaxChange send options for fax.


Solution:

With MS Outlook you can install CDO (Collaboration Data Objects) object. And this CDO object can be used to send a fax from your application. You can also set all of FaxChange send options throught CDO.

There is a code sample following. It is written in Visual Basic Script, but it can be used from almost any programing language in the same way.

Dim ProfileName
' Select your MAPI profile
ProfileName = "Petr Brouzda"
Dim objSession
Dim objMessage
Dim objOneRecip
' Create a session
Set objSession = CreateObject("MAPI.Session")
' Change the parameters to valid values for your configuration
objSession.Logon ProfileName
' Create a message and fill in its properties
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = "Sample Message"
objMessage.Text = "This is sample message text."
' Create the recipient
Set objOneRecip = objMessage.Recipients.Add
objOneRecip.Name = "Datasys Support Line[fax:+420261388444]"
objOneRecip.Type = 1
objOneRecip.Resolve
' -----------------------------------------------------------------
' FaxChange custom properties:
' Coversheet
' 0 = default coversheet
' 1 = no coversheet
' 3 = specific coversheet, property &h510f001e should be filled with coversheet name
objMessage.Fields.Add &h510B0003, 3
objMessage.Fields.Add &h510f001e, "bigsample.cvs"    'only to be enabled if "specific coversheet" should be used
' Scheduling... is not easy
' 51010003 : 0 = send now
'            1 = schedule
'
' Following fields are used only when 51010003 = 1:
' 51030003 = day offset : 0 = today
'                         1 = tomorrow
'                         2 = monday, 3 = tuesday ...
' 51060003 = hour (0-23)
' 51090003 = quarter-hour ( 0 = 00 min, 1 = 15 min, 2 = 30 min, 3 = 45 min )
'
' This sample schedules the fax to Wednesday, 22:45
objMessage.Fields.Add &h51010003, 1
objMessage.Fields.Add &h51030003, 4
objMessage.Fields.Add &h51060003, 22
objMessage.Fields.Add &h51090003, 3
' Preview
' 1 = send preview
' 2 = don't sent preview
objMessage.Fields.Add &h516B0003, 2
' Resolution
' If set, resolution of 100 DPI (low) will be used. Otherwise 200 DPI (fine) is used.
' objMessage.Fields.Add &h51670003, 1
' Custom items 1 to 3
objMessage.Fields.Add &h5160001e, "Custom field 1"
objMessage.Fields.Add &h5161001e, "Custom field 2"
objMessage.Fields.Add &h5162001e, "Custom field 3"
' User ID
objMessage.Fields.Add &h5170001e, "My specific ID 723472374"
' Custom CSID
objMessage.Fields.Add &h5173001e, "DATASYS CSID"
' Costcode
' 0 = use default costcode
' 1 = use specific costcode
objMessage.Fields.Add &h51200003, 1
objMessage.Fields.Add &h5122001e, "MyCostCode1"
' -----------------------------------------------------------------
' Send the message and log off
objMessage.Send True, False
' All OK, logoff
objSession.Logoff


Further information:


Keywords:

FaxChange,API,CDO,send fax,send,program,programatically


If there is something unclear, send us an email to development@datasys.cz.