Kbase 21890: 4GL -- How To Create Items in Outlook Using OLEAutomation
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/15/2002 |
|
SUMMARY:
This Solution shows you how to add different items in Outlook using OLEAutomation.
EXPLANATION:
Using OLEAutomation, different types of items can be added; the Type of item is specified as a parameter in:
<com-handle-session>:CreateItem(<int-value>).
This list shows the item types and the corresponding integer value to use in the CreateItem method.
Item Type Item Number
Appointment 1
Contact 2
Distribution 7
Journal 4
Mail 0
Note 5
Post 6
Task 3
Note that properties and methods will change according to the Item Type.
The following examples show how to create an Appointment and a Task item in Outlook:
/*------------------------------
Appointment
------------------------------*/
DEFINE VARIABLE hSession AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hItem AS COM-HANDLE NO-UNDO.
CREATE "outlook.application" hSession.
ASSIGN hItem = hSession:CreateItem(1).
ASSIGN hItem:Subject = "Meeting test"
hItem:START = "03/14/02 10:21:00"
hItem:END = "03/14/02 18:00:00"
hItem:body = "Body meeting test"
hItem:Importance = 2
hItem:ReminderMinutesBeforeStart = 5
hItem:ReminderPlaySound = TRUE
hItem:meetingstatus = 1 /*Send an e-mail for the users specified in RequiredAttendees*/
hItem:RequiredAttendees = "<mailAddress1>;<mailAddress2>".
hItem:SAVE().
hItem:SEND().
RELEASE OBJECT hSession.
RELEASE OBJECT hItem.
/*--------------------
Task
--------------------*/
DEFINE VARIABLE hSession AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hItem AS COM-HANDLE NO-UNDO.
CREATE "outlook.application" hSession.
ASSIGN hItem = hSession:CreateItem(3).
ASSIGN hItem:Subject = "Task test"
hItem:body = "Body Task test"
hItem:Importance = 2
hItem:ReminderSet = TRUE
hItem:ReminderTime = "03/14/02 16:10"
hItem:ReminderPlaySound = TRUE.
hItem:SAVE().
hItem:ASSIGN().
RELEASE OBJECT hSession.
RELEASE OBJECT hItem.