IMAPIFolder::GetMessageStatus

Applies to: Outlook 2013 | Outlook 2016

Obtains the status associated with a message in a particular folder (for example, whether that message is marked for deletion).

HRESULT GetMessageStatus(
  ULONG cbEntryID,
  LPENTRYID lpEntryID,
  ULONG ulFlags,
  ULONG FAR * lpulMessageStatus
);

Parameters

cbEntryID

[in] The byte count in the entry identifier pointed to by the lpEntryID parameter.

lpEntryID

[in] A pointer to the entry identifier for the message whose status is obtained.

ulFlags

[in] Reserved; must be zero.

lpulMessageStatus

[out] A pointer to a pointer to a bitmask of flags that indicate the message's status. Bits 0 through 15 are reserved and must be zero; bits 16 through 31 are available for implementation-specific use. The following flags can be set:

MSGSTATUS_DELMARKED

The message has been marked for deletion.

MSGSTATUS_HIDDEN

The message is not to be displayed.

MSGSTATUS_HIGHLIGHTED

The message is to be displayed highlighted.

MSGSTATUS_REMOTE_DELETE

The message has been marked for deletion at the remote message store without downloading to the local client.

MSGSTATUS_REMOTE_DOWNLOAD

The message has been marked for downloading from the remote message store to the local client.

MSGSTATUS_TAGGED

The message has been tagged for a client-defined purpose.

Return value

S_OK

The message status was successfully retrieved.

Remarks

The IMAPIFolder::GetMessageStatus method returns the status of a message. Message status is stored in the message's PR_MSG_STATUS (PidTagMessageStatus) property.

Notes to implementers

How the message status bits are set, cleared, and used depends completely on your implementation, except that bits 0 through 15 are reserved and must be zero. If you store messages in the IPM subtree, MAPI reserves bits 16 through 31 for use by IPM clients. If you store messages in other subtrees, you can use bits 16 through 31 for your own purposes.

MFCMAPI reference

For MFCMAPI sample code, see the following table.

File Function Comment
MyMAPIFormViewer.cpp
CMyMAPIFormViewer::GetNextMessage
MFCMAPI uses the IMAPIFolder::GetMessageStatus method to get the status of the next message to be displayed.
MAPIFormFunctions.cpp
OpenMessageNonModal and OpenMessageModal
MFCMAPI uses the IMAPIFolder::GetMessageStatus method to get the status of the message to be displayed to pass to the form viewer, which is either CMyMAPIFormViewer or IMAPISession::ShowForm.

See also

IMAPIFolder::SetMessageStatus

IMAPISession::ShowForm

PidTagMessageStatus Canonical Property

IMAPIFolder : IMAPIContainer

MFCMAPI as a Code Sample