mailGetMessages
PowerScript function
Description
Populates the messageID array of a mailSession object with the
message IDs in the user’s inbox.
Applies to
mailSession object
Syntax
|
1 |
mailsession.mailGetMessages ( { messagetype, } { unreadonly } ) |
|
Argument |
Description |
|---|---|
|
mailsession |
A mailSession object identifying the session in which you |
|
messagetype (optional) |
A string whose value is a message type. The default |
|
unreadonly (optional) |
A boolean value indicating you want only the IDs of unread
|
Return value
mailReturnCode. Returns one of the following values:
mailReturnSuccess!
mailReturnFailure!
mailReturnInsufficientMemory!
mailReturnNoMessages!
mailReturnUserAbort!
If any argument’s value is null, mailGetMessages returns
null.
Usage
MailGetMessages only retrieves message IDs, which it stores in the
mailSession object’s MessageID array. A message ID serves as an argument
for other mail functions. With mailReadMessage, for example, it identifies
the message you want to read.
Before calling mail functions, you must declare and create a
mailSession object and call mailLogon to establish a mail session.
Examples
This example populates a DataWindow with the messages in the user’s
inbox. The DataWindow is defined with an external data source and has
three columns: msgid, msgdate, and msgsubject. MailGetMessages fills the
MessageID array in the mailSession object and mailReadMessage gets the
information for each ID.
The example assumes that the application has already created the
mailSession object mSes and logged on:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
mailMessage msg long n, c_row mSes.mailGetMessages() FOR n = 1 to UpperBound(mSes.MessageID[]) mSes.mailReadMessage(mSes.MessageID[n], & msg, mailEnvelopeOnly!, FALSE) c_row = dw_1.InsertRow(0) dw_1.SetItem(c_row, "msgid", mSes.MessageID[n]) dw_1.SetItem(c_row, "msgdate", msg.DateReceived) // Truncate subject to fit defined column size dw_1.SetItem(c_row, "msgsubject", & Left(msg.Subject, 50)) NEXT |
See also