OnSave Method
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

OnSave Method

Exchange Server 2003

OnSave Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Called by a store when an item is saved.

Applies To

Type Library

EXOLEDB Type Library

DLL Implemented In



        [Visual Basic]Sub OnSave
    ByVal pEventInfo As IExStoreEventInfo,     ByVal bstrURLItem As String,     ByVal IFlags As LONG

        [C++]HRESULT OnSave
    BSTR bstrURLItem,
    LONG IFlags


A pointer to an IExStoreEventInfo Interface that can be used to obtain additional information related to the event.
A string containing a URL to the new saved item.

The following (bitwise AND) flags can give you additional information about the save event:

Decimal Value C++ Enum Equivalent Meaning
1 EVT_NEW_ITEM The item being saved is new.
2 EVT_IS_COLLECTION The item being saved is a collection.
4 EVT_REPLICATED_ITEM The item is being saved as a result of replication.
8 EVT_IS_DELIVERED The item is being saved as the result of message delivery.
64 EVT_INITNEW This flag is set at the first firing of the event. (This is useful for initialization purposes. It is set only once during the lifetime of a created event sink.)
256 EVT_MOVE The item was moved, resulting in an implicit save.
512 EVT_COPY The item was copied, resulting in an implicit save.

Return Value

Returns S_OK if successful, or an error value otherwise.

Registration Properties

To register for this event, you need to set the registration item's EventMethod Field property to "OnSave" (C++ constant = EVT_ON_SAVE).

This event supports the following properties of Event Registration Items:

Criteria Field

Enabled Field

EventMethod Field

MatchScope Field

ScriptUrl Field

SinkClass Field


This event is fired when a new item enters the store, when an existing item is saved, and when an item is moved or copied. This event does not fire when the item's parent folder is moved or copied.

See the IAsyncNotify Interface for information about processing asynchronous events in a Component Object Model (COM) object.

© 2016 Microsoft