I am trying to read through mail for a specific Lotus Notes user and to detach all attachments that I find. So far I have the following:
I found the following VB code which seems to be what I am looking for, but I can't figure out how to convert it to Progress. Specifically, how would the "For Each attch In itm.EmbeddedObjects" translate?
Can anyone help me with this? Has anyone tried to do anything similar to this?
Any help would be greatly appreciated.
Anne
Code:
DEFINE VARIABLE chSession AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chDatabase AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chView AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chDocument AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chItem AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chAttach AS COM-HANDLE NO-UNDO.
CREATE "NOTES.NOTESSESSION" chSession NO-ERROR.
IF NOT VALID-HANDLE(chSession) THEN DO:
MESSAGE "Could NOT establish session" VIEW-AS ALERT-BOX.
RELEASE OBJECT chSession.
RETURN.
END.
chDatabase = chSession:GETDATABASE("NotesServer",
"mail\user.nsf")
NO-ERROR.
IF NOT VALID-HANDLE(chDatabase) THEN DO:
MESSAGE "Could not access or create database" VIEW-AS ALERT-BOX.
RELEASE OBJECT chDatabase.
RELEASE OBJECT chSession.
RETURN.
END.
chView = chDatabase:GetView("($Inbox)").
IF NOT VALID-HANDLE(chView) THEN DO:
MESSAGE "Could not retrieve Lotus Notes View ..."
"KeyChartsCOM record not created"
VIEW-AS ALERT-BOX.
RELEASE OBJECT chView.
RELEASE OBJECT chDatabase.
RELEASE OBJECT chSession.
RETURN.
END.
chDocument = chView:GetFirstDocument.
DO WHILE VALID-HANDLE(chDocument):
IF chDocument:HasEmbedded THEN DO:
chItem = chDocument:GetFirstItem("Body").
[b]/*** This is where I need the help ***/[/b]
END.
chDocument = chView:GetNextDocument(chDocument).
END.
I found the following VB code which seems to be what I am looking for, but I can't figure out how to convert it to Progress. Specifically, how would the "For Each attch In itm.EmbeddedObjects" translate?
Code:
If itm.Type = RICHTEXT Then
Dim attch As Variant
For Each attch In itm.EmbeddedObjects
If (attch.Type = EMBED_ATTACHMENT) Then
attch.ExtractFile sPathToSave & attch.Name
End If
Next
End If
Can anyone help me with this? Has anyone tried to do anything similar to this?
Any help would be greatly appreciated.
Anne