Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lotus Notes Anyone?
Message
 
À
11/02/2003 16:40:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00752051
Message ID:
00752213
Vues:
23
Hi Erik

Here is a routine I picked up on the UT recently:

PROCEDURE SendLotusMessage
LPARAMETER tcRecipient, tcSubject, tcMessage, tcAttachment

*-- check parameters ------------------------------------------------------------------------------
IF TYPE("tcRecipient") <> "C" OR EMPTY(tcRecipient)
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 1 : Parameter missing or wrong type. Procedure cancelled!"
RETURN -1
ENDIF
IF TYPE("tcSubject") <> "C" OR EMPTY(tcSubject)
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 2 : Parameter missing or wrong type. Procedure cancelled!"
RETURN -2
ENDIF
IF TYPE("tcMessage") <> "C" OR EMPTY(tcMessage)
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 3 : Parameter missing or wrong type. Procedure cancelled!"
RETURN -3
ENDIF
IF PCOUNT() = 4 AND (!TYPE("tcAttachment")="C" OR !FILE(tcAttachment))
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 4 : File not found. Procedure cancelled!"
RETURN -4
ENDIF
*--------------------------------------------------------------------------------------------------

LOCAL loNotes, loDb, loDoc, lcMsg, loRichTextItem

loNotes = CreateObject("Notes.Notessession") && create notes session
loDb = loNotes.GetDatabase("", "") && set db to database not yet named
loDb.openmail && set database to default mail database

loDoc = loDb.CreateDocument && create a mail document

loDoc.ReplaceItemValue("SendTo", tcRecipient) && Recipient
loDoc.ReplaceItemValue("Subject", tcSubject) && Subject
loDoc.ReplaceItemValue("Body", tcMessage) && Message Body

*-- check if there's an attachment
IF !EMPTY(tcAttachment)
loRichTextItem = loDoc.CreateRichTextItem("Attachment") &&
=loRichTextItem.EmbedObject(1454, "", tcAttachment) && attach a file
ENDIF

loDoc.Save(.T., .T.) && save message
loDoc.Send(.f.) && send message

RELEASE loNotes

endproc
Kevin Delaney
Financial Systems Manager
CPL Solutions Ltd

83 Merrion Square, Dublin 2, Ireland.
e: kevin.delaney@cpl.ie w: www.cpl.ie
p: +353 1 482-5368
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform