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

OnSyncDelete Method

Exchange Server 2003

OnSyncDelete 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 being deleted.

Applies To

Type Library

EXOLEDB Type Library

DLL Implemented In



        [Visual Basic]Sub OnSyncDelete
    pEventInfo As IExStoreEventInfo,     bstrURLItem As String,     lFlags As LONG

        [C++]HRESULT OnSyncDelete
    BSTR bstrURLItem,
    LONG lFlags


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 item that will be deleted upon successful completion of all synchronous events. When the transaction is open, this variable is unlocked.
The following (bitwise AND) flags can give you further information about the delete event:
Decimal EquivalentC++ Enum EquivalentMeaning
2EVT_IS_COLLECTIONThe item being deleted is a collection.
4EVT_REPLICATED_ITEMThe item is being replicated from another location.
16EVT_SOFTDELETEThe item has been moved to the Recycle Bin (soft delete).
32EVT_HARDDELETEThe item has left the store message database (MDB) (hard delete).
256EVT_MOVEThe item was moved, resulting in an implicit delete.
64EVT_INITNEWThis 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.)
33554432EVT_SYNC_COMMITTEDSynchronous committed event.
67108864EVT_SYNC_ABORTEDSynchronous aborted event.
1073741824EVT_INVALID_URLThe URL passed to the sink is invalid.
2147483648EVT_ERRORAn error occurred in the event.

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 "OnSyncDelete" (C++ constant = EVT_ON_SYNC_DELETE).

This event supports the following properties of Event Registration Items:

Criteria Field

Enabled Field

EventMethod Field

MatchScope Field

Priority Field

ScriptUrl Field

SinkClass Field


This event is fired when an item is deleted from the store, or when an item is moved in the store. This event is not fired when the item's parent folder is moved or deleted.

The OnDelete event uses the EVT_HARDDELETE and EVT_SOFTDELETE flags to distinguish between hard and soft deletes. A soft delete is defined as a delete that moves an item into the Recycle Bin. A hard delete is defined as a delete in which an item is completely removed from the store.

Aborting the transaction associated with this event will prevent the item from being deleted. If you abort an event that is the result of a move, then both the save and delete steps of the move will be aborted. This means that the original item will not be deleted and the new item will not be saved.

See Synchronous Event Methods and Working with Synchronous Events for more information.

© 2016 Microsoft