Consultor Eletrônico



Kbase P8705: How to handle "events" using Outlook as interface
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/25/2003
Status: Unverified

GOAL:

How to handle "events" using Outlook as interface

FACT(s) (Environment):

Progress 9.1D

FIX:

Each 'Event' needs to be enabled against a valid com-handle for the particular event you are trying to trap.

PROCEDURE OutlookEvents.close:
MESSAGE "closing" VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.

PROCEDURE ItemEvents.Send:
DEFINE INPUT PARAMETER Cancel AS LOGICAL.
MESSAGE "sending" VIEW-AS ALERT-BOX INFO BUTTONS OK.
END PROCEDURE.

define variable ch_outlook as com-handle NO-UNDO.
define variable ch_namespace as com-handle NO-UNDO.
define variable ch_folder as com-handle NO-UNDO.
define variable ch_item as com-handle NO-UNDO.

create "outlook.application":U ch_outlook.

assign ch_namespace = ch_outlook:getnamespace("MAPI":U)
ch_folder = ch_namespace:getdefaultfolder(6).

assign ch_item = ch_outlook:createitem(0). /* mailitem */

ch_item:save.

ch_item:display.

ch_outlook:ENABLE-EVENTS('OutlookEvents').
ch_item:ENABLE-EVENTS('ItemEvents').

WAIT-FOR "CLOSE" OF THIS-PROCEDURE.

RELEASE OBJECT ch_item NO-ERROR.
RELEASE OBJECT ch_folder NO-ERROR.
RELEASE OBJECT ch_namespace NO-ERROR.

NO-RETURN-VALUE ch_outlook:quit() .
RELEASE OBJECT ch_outlook NO-ERROR.

This will launch Outlook, and give messages when some events fire.