Partager via


DocumentItem.BeforeRead Event (Outlook)

Occurs before Microsoft Outlook begins to read the properties for the item.

Version Information

Version Added: Outlook 2010

Syntax

expression .BeforeRead

expression A variable that represents a DocumentItem object.

Remarks

The BeforeRead event occurs before the Read event. Unlike other events with the Before prefix, this event is not cancelable. To determine when the item is unloaded from memory, use the Unload event.

The BeforeRead event corresponds to the Exchange Client Extensions (ECE) event IExchExtMessageEvents::OnRead.

Only the following members of the item object can be accessed in the BeforeRead event:

The MAPIOBJECT property is a hidden property in the Outlook object model. This property provides access to the underlying MAPI IMessage object, and can be invoked only via the IUnknown interface. The property is accessible to programs written in languages such as C or C++ that support IUnknown. MAPIOBJECT is not available through the IDispatch interface. Development languages such as Visual Basic for Applications (VBA), Visual C#, and Visual Basic support the IDispatch interface and not IUnknown, and therefore, they cannot access MAPIOBJECT. If other properties or methods of the parent item are accessed in this event, Outlook raises an error.

If the implementer accesses the underlying IMessage object and changes properties on that object, Outlook will render that item reflecting the changes to the IMessage object. The implementer does not have to call SaveChanges on the IMessage object to cause the changes to be reflected in Outlook.

Implementers must release the object obtained from the MAPIOBJECT property in the event before the event completes. Attempting to use that object outside the context of the event is unsupported and will lead to unpredictable behavior.

See Also

Concepts

DocumentItem Object Members

DocumentItem Object