IMAPIFolder::SetReadFlags
Published: July 16, 2012
Sets or clears the MSGFLAG_READ flag in the PR_MESSAGE_FLAGS (PidTagMessageFlags) property of one or more of the folder's messages, and manages the sending of read reports.
HRESULT SetReadFlags( LPENTRYLIST lpMsgList, ULONG_PTR ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags );
The IMAPIFolder::SetReadFlags method sets or clears the MSGFLAG_READ flag in the PR_MESSAGE_FLAGS property of one or more of the folder's messages. Setting the MSGFLAG_READ flag marks a message as read, which does not necessarily indicate that the intended recipient has actually read the message.
SetReadFlags also manages the sending of read reports.
The read flag cannot be changed for the following:
-
Messages that do not exist.
-
Messages that have been moved elsewhere.
-
Messages that are open with read/write permission.
-
Messages that are currently submitted.
You can decide not to support the sending of read reports and the request to suppress read reports. To avoid suppressing a read report, return MAPI_E_NO_SUPPRESS when SetReadFlags is called with SUPPRESS_RECEIPT set in the ulFlags parameter.
When the lpMsgList parameter points to more than one message, perform the operation as completely as possible for each message. Do not stop the operation prematurely unless a failure occurs that is beyond your control, such as running out of memory, running out of disk space, or corruption in the message store.
If none of the flags are set in the ulFlags parameter, the following rules apply:
-
If MSGFLAG_READ is already set, do nothing.
-
If MSGFLAG_READ is not set, set it immediately and send any pending read reports if the PR_READ_RECEIPT_REQUESTED (PidTagReadReceiptRequested) property is set.
When the SUPPRESS_RECEIPT flag is set, the following rules apply:
-
If MSGFLAG_READ is already set, do nothing.
-
If MSGFLAG_READ is not set, set it and cancel any pending read reports.
When the CLEAR_READ_FLAG flag is set, clear the MSGFLAG_READ flag in each message's PR_MESSAGE_FLAGS property and do not send any read reports.
When the GENERATE_RECEIPT_ONLY flag is set, send any pending read reports. Do not set or clear MSGFLAG_READ.
When both the SUPPRESS_RECEIPT and GENERATE_RECEIPT_ONLY flags are set, set PR_READ_RECEIPT_REQUESTED to FALSE if it is set and do not send a read report.
Expect these return values under the following conditions.
|
Condition |
Return value |
|---|---|
|
SetReadFlags has successfully processed every message. |
S_OK |
|
SetReadFlags was unable to successfully process every message. |
MAPI_W_PARTIAL_COMPLETION or MAPI_E_NOT_FOUND |
|
SetReadFlags was unable to complete. |
Any error value except MAPI_E_NOT_FOUND |
When SetReadFlags is unable to complete, do not assume that no work was done. SetReadFlags might have been able to set or clear the MSGFLAG_READ flag for one or more of the messages before encountering the error.