Unread Property (Message Object)
Unread Property (Message Object)
The Unread property is True if the message has not been read by the current user. Read/write.
Syntax
objMessage.Unread
Data Type
Boolean
Remarks
In general, there are three different kinds of messages: sent, posted, and saved. Sent messages are traditional e-mail messages sent to a recipient or public folder. Posted messages are created in a public folder. Saved messages are created and saved without either sending or posting.
For all three kinds of messages, you use the Sent, Submitted, and Unread properties and the Send or Update methods.
The following table summarizes the use of the message properties and methods for the three kinds of messages. In some systems the message store and transport providers are tightly coupled, in which case they bypass the spooler and perform its functions themselves.
Kind of message |
Method used |
Sent property |
Submitted property |
Unread property |
Sent |
Send |
Spooler sets True |
Send sets True |
Spooler sets True |
Posted |
Update |
Application sets True |
Application sets False |
Application sets True |
Saved |
Update |
Application sets False |
Application sets False |
Application sets True |
The Unread property should initially be True for all three kinds of messages. The messaging system takes care of this for a sent message; you must set the property for a posted or saved message. The messaging system also resets Submitted to False when the message arrives in a recipient's Inbox. Each receiving user sets the Unread property to False as it reads its copy of the received message.
Note When you set Unread to False, the MSGFLAG_READ flag of the MAPI property PR_MESSAGE_FLAGS is immediately updated in the message store. However, to improve performance by reducing RPCs, the store might not communicate this change to a messaging client until contacted by the client. Therefore, a client such as the Microsoft® Exchange Client or Microsoft® Outlook® may continue to show the message as unread for some indeterminate period of time.
For more information on sending and posting messages, see Creating and Sending a Message and Posting Messages to a Public Folder.
The Unread property is not exposed on AppointmentItem objects created by Microsoft® Schedule+, and it is not automatically set when you create an appointment within a CDO application until you call the Update method. In these cases, the application must assign a value to Unread or an attempt to read it returns CdoE_NOT_FOUND.
The Unread property corresponds to the MSGFLAG_READ flag not being set in the MAPI property PR_MESSAGE_FLAGS. It can be rendered into HTML hypertext using the CDO Rendering ObjectRenderer object. To specify this, set the object renderer's DataSource property to this Message object and the property parameter of the RenderProperty method to CdoPR_MESSAGE_FLAGS. However, you must assign a CDO Rendering Format object to the PR_MESSAGE_FLAGS property and use the Value property of the format's Pattern objects to isolate the MSGFLAG_READ flag's setting for rendering.