MapiGetNextMsgId Function


Returns the next message ID in the inbox of the MAPI session. To retrieve the first message, pass an empty message ID as LastMsgId. Please note that MapiGetNextMsgId retrieves messages in chronologically ascending order, i.e., from oldest to most current. Thus, to retrieve the most current message, it is necessary to iterate through all messages in the inbox.

Include file



MapiGetNextMsgId( in hSession  : number, 
                  in sLastMsgId: string, 
                  in sNextMsgId: string ) : boolean;
Parameter Description
hSession Valid MAPI Session Handle
sLastMsgId Last Message ID or empty value to get the first message
sNextMsgId Will retrieve the next message in the current MAPI Session.

Return value

  • true if successful
  • false otherwise


See MAPI Sample