xp_findnextmsg

Description

(Windows only) Retrieves the next message identifier from the Adaptive Server message inbox.

Syntax

xp_findnextmsg @msg_id = @msg_id  output[, type]
	[, unread_only = {true | false}]

Parameters

msg_id

on input, specifies the message identifier that immediately precedes the one you are trying to retrieve. Places the retrieved message identifier in the msg_id output parameter, which must be of type binary.

type

is the input message type based on the MAPI mail definition. The only supported message type is CMC:IPM. A NULL value or no value defaults to CMC:IPM.

unread_only

if this parameter is set to true, xp_findnextmsg considers only unread messages. If this parameter is set to false, xp_findnextmsg considers all messages, both read and unread, when retrieving the next message identifier. The default is true.

Examples

Example 1

Returns, in the @out_msg_id output variable, the message identifier of the next unread message after the message specified by the @out_msg_id:

xp_findnextmsg @msg_id = @out_msg_id output

Example 2

Returns, in the @out_msg_id output variable, the message identifier of the next message after the message specified by the @out_msg_id. The message may be read or unread:

xp_findnextmsg @msg_id = @out_msg_id output, NULL, @unread_only = false

Usage

Permissions

By default, only a System Administrator can execute xp_findnextmsg. A System Administrator can grant this permission to other users.