MCFMailStore Methods

This section discusses MCFMailStore class methods.

Syntax

AuthorizeEmailAttach(email ID, authentication name, authentication type, operation)

Description

Use AuthorizeEmailAttach to authorize a user or a PeopleSoft role to view attachments associated with an email. By default, no user or role is authorized to view an email; you must explicitly grant authorization with this method. This method authorizes email and the associated attachments one at a time.

Note: If you specify ALL as the user, any user can view the attachments for an email.

Parameters

Field or Control

Definition

email ID

The unique email ID for the email. This is the PeopleSoft email ID, not the ID issued by the mail server.

authentication name

The name of the PeopleSoft user profile or role that needs to be authorized to view the attachments.

authentication type

Specify the type security definition entered as the authentication name.

  • Specify 2 to indicate a user profile.

  • Specify3 to indicate a role.

operation

Specify the type of authorization operation. The following list contains the supported operations. You either add or delete user or role authorization.

  • 1 = ADD

  • 2 = DELETE

Returns

Returns a Boolean value: True for success, False otherwise.

Example

&ms = create MCFMailStore();
&status = &ms.AuthorizeEmailAttach(&emailid, "MCFUser", 2, 1);

Syntax

DeleteEmail(email ID, forced delete)

Description

Deletes the specified email from the PeopleSoft database and corresponding attachments from the directory where they are stored.

Parameters

Field or Control

Definition

email ID

The ID used to uniquely identify each email within the PeopleSoft database.

forced delete

This parameter is used to set the forced delete flag. It is a Boolean value. A forced delete ensures that the deletion process continues even in cases where the process encounters issues or errors related to an email. For example, with forced delete enabled, the deletion process continues even though the attachments of the email cannot be found or do not exist.

True means “force delete” and False means “do not force delete if there is an error in deleting this email.”

Returns

Returns a Boolean value. True for success, False otherwise.

Example

Local MCFMailStore &ms;

&ms = create MCFMailStore();
&forcedel = True;
&status = &ms.DeleteEmail(&emailid, &forcedel);

Syntax

RetrieveEmail(email ID)

Description

Use RetrieveEmail to read email from the PeopleSoft database.

Parameters

Field or Control

Definition

email ID

The ID that uniquely identifies an email within the PeopleSoft database.

Returns

Returns a rowset.

Example


Local MCFMailStore &ms;
Local Rowset &EMAIL_ROWSET;

&ms = create MCFMailStore();
&EMAIL_ROWSET = &ms.RetrieveEmail(&emailid);

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

Field or Control

Definition

&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;