MailItem.Read Event (Outlook)

Occurs when an instance of the parent object is opened for editing by the user.

expression .Read

expression A variable that represents a MailItem object.

The Read event differs from the Open event in that Read occurs whenever the user selects the item in a view that supports in-cell editing as well as when the item is being opened in an Inspector.

This Visual Basic for Applications (VBA) example uses the Read event to increment a counter that tracks how often an item is read.

Public WithEvents myItem As Outlook.MailItem 
 
 
 
Sub Initialize_handler() 
 
 Set myItem = Application.ActiveExplorer.CurrentFolder.Items(1) 
 
 myItem.Display 
 
End Sub 
 
 
 
Sub myItem_Read() 
 
 Dim myProperty As Outlook.UserProperty 
 
 Set myProperty = myItem.UserProperties("ReadCount") 
 
 If (myProperty Is Nothing) Then 
 
 Set myProperty = myItem.UserProperties.Add("ReadCount", olNumber) 
 
 End If 
 
 myProperty.Value = myProperty.Value + 1 
 
 myItem.Save 
 
End Sub
Show:
© 2014 Microsoft