Consultor Eletrônico



Kbase P146491: 4GL/ABL: How to save an outlook attachment using 4GL/ABL?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/18/2009
Status: Unverified

GOAL:

4GL/ABL: How to save an outlook attachment using 4GL/ABL?

GOAL:

How to programmatically save the first attachment of the active Outlook e-mail message Item?

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

FIX:

The following 4GL/ABL code demonstrates how to save the first attachment item of the currently active e-mail message on the local hard drive. The code assumes that Outlook is open and an e-mail message that has one or more attachments is currently selected:

DEFINE VARIABLE myOlApp AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE myInspector AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE myItem AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE myAttachments AS COM-HANDLE NO-UNDO.
CREATE "Outlook.Application" myOlApp.
ASSIGN
myInspector = myOlApp:ActiveInspector
myItem = myInspector:CurrentItem
myAttachments = myItem:Attachments.
myAttachments:Item(1):SaveAsFile("C:\myAttachment.xls").
RELEASE OBJECT myOlApp.
RELEASE OBJECT myInspector.
RELEASE OBJECT myItem.
RELEASE OBJECT myAttachments.
ASSIGN
myOlApp = ?
myInspector = ?
myItem = ?
myAttachments = ?.