Share this page

# mapi_read_next_mail_ex

MS Exchange Server Functions (mapi)

Reads the next mail in the mailbox for a specific session.

    int mapi_read_next_mail_ex( MAPI *ppmapi, char *transaction, char *Show, [char *Peek,][char *Type,][char *Save,][char *MessageId,] LAST );

ppmapi | A session identifier.
transaction | A transaction name for this step in quotes. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
Show | The show option of the mail message in the format: `"Show=id | heading | summary | all (default`)`"`
Peek | The peek setting. If set to true, the function just peeks at the message without reading it. The message will not be marked as read. `"Peek=true | false (default)"`
Type | The type of mail message. For example, IPM.Note indicates a sticky note. The default is a simple mail message. Use the following format: `"Type=mail_type"`
Save | Save the body of the current message to the "Content" property: "`Save=body`"
MessageId | Sets which mail to read next: "`MessageId =<Message Id>`"
LAST | A marker indicating the end of the argument list.

The mapi_read_next_mail_ex function reads the next mail message in the mailbox, for the specified session. Using the Peek option, you can control whether or not to mark the mail as read or unread.

This function is for use with multiple sessions. For global sessions, use the mapi_read_next_mail function, which leaves out the session identifier.

## Return Values

If this function succeeds, it returns LR_PASS. Otherwise, it returns LR_FAIL.

When there are no more messages in the mailbox, returns LR_MAPI_NO_MORE_MESSAGES (0x80000001).

## Parameterization

All arguments of this function of the type char, can be parameterized with standard parameterization.

## Example

In the following example, the mapi_read_next_mail_ex peeks at a sticky note message.

    // Reset mail to beginning of mailbox

        mapi_set_property_sz_ex(&mapi,"Message ID", "");

        do {
            // Peek at next mail (don't mark it as read)
            rc = mapi_read_next_mail_ex(&mapi,"NextMail",
            "Show=all",
           "Peek=True",    ]
           "Type=IPM.Note",
           LAST );
        } while (rc == LR_PASS);

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: