StoreEmail method: MCFMailStore class

Syntax

StoreEmail(&rowset, row)

Description

The StoreEmail method inserts an email retrieved from the mail server into the PeopleSoft database. PeopleSoft stores the contents or pieces of the email in rowsets and child rowsets.

Parameters

Parameter Description

&rowset

The rowset containing the contents of an email. The rowset should be the rowset used by the MCFGetMail class to retrieve emails from the mail server. The rowset should be an already instantiated rowset.

Note: The first row of the rowset is empty. The first email in the rowset has a row value of 2.

row

The row number in which the email data is stored.

Note: The first row is always empty. Row 2 always contains the first email of the rowset.

Returns

Returns a PeopleSoft email ID to act as the unique key for a particular email within the PeopleSoft database.

Returns 0 if an error occurred.

Example

Local MCFGetMail &GM;
Local Rowset &rs;
Local number &nemails;
Local string &email_id;

&GM = create MCFGetMail();
&rs = &GM.ReadEmailsWithAttach(&user, &password, &server, &ibnode, 
&count);

/* Get the number of emails in the recordset from MCF_NUMROWS field */
&nemails = &rs.GetRow(1).GetRecord(Record.MCFEM_RES_MAIN).GetField
(Field.MCF_NUMROWS).Value;
   If (&nemails > 0) Then
/* First row in the rowset is for header info only. Start writing from
 second row */
      For &i = 1 To &nemails
         &email_id = &ms.StoreEmail(&rs, &i + 1);
         If (&email_id <> 0) Then
            /* Store was successful - email ID returned = &email_id */
         Else
            /* Error in storing email */
         End-If;
      End-For;
   End-If;