OnSyncDelete Method

Topic Last Modified: 2007-06-18

The OnSyncDelete method is called by a store when an item is being deleted.

Applies To

IExStoreSyncEvents Interface

Type Library

EXOLEDB Type Library

DLL Implemented In

EXOLEDB.DLL

Syntax

Sub OnSyncDelete(    pEventInfo As IExStoreEventInfo,
        bstrURLItem As String,
        lFlags As LONG)

HRESULT OnSyncDelete
(
        IExStoreEventInfo* pEventInfo,
        BSTR bstrURLItem,
        LONG lFlags
);

Parameters

  • bstrURLItem
    A string that contains 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.
  • lFlags
    The following (bitwise AND) flags can give you additional information about the delete event.

    Decimal Equivalent C++ Enum Equivalent Meaning

    2

    EVT_IS_COLLECTION

    The item being deleted is a collection.

    4

    EVT_REPLICATED_ITEM

    The item is being replicated from another location.

    16

    EVT_SOFTDELETE

    The item has been moved to the Recycle Bin (soft delete).

    32

    EVT_HARDDELETE

    The item has left the store message database (MDB) (hard delete).

    256

    EVT_MOVE

    The item was moved, causing an implicit delete.

    64

    EVT_INITNEW

    This flag is set at the first occurrence of the event. (This is useful for initialization purposes. It is set only once during the lifetime of a created event sink.)

    33554432

    EVT_SYNC_COMMITTED

    Synchronous committed event.

    67108864

    EVT_SYNC_ABORTED

    Synchronous aborted event.

    1073741824

    EVT_INVALID_URL

    The URL passed to the sink is invalid.

    2147483648

    EVT_ERROR

    An error occurred in the event.

The following table describes the events that are triggered by Microsoft Office Outlook 2003 when cached connections to the computer that is running Microsoft Exchange Server 2007are used with a message selected.

Cached connection events

Outlook Action C++ Enum Eqivalent

Delete Key Pressed

EVT_SOFTDELETE | EVT_HARDDELETE

Drag to Deleted Items folder

EVT_SOFTDELETE | EVT_HARDDELETE

Shift-Delete Keys Pressed

EVT_SOFTDELETE

The following table describes the events that are triggered by Outlook 2003 when non-cached connections to the Exchange server are used with a message selected.

Non-cached connection events

Outlook Action C++ Enum Equivalent

Delete Key Pressed

EVT_MOVE

Drag to Deleted Items folder

EVT_MOVE

Shift-Delete Keys Pressed

EVT_SOFTDELETE

Return Value

The OnSyncDelete method Returns S_OK if it is successful; otherwise, the method returns an error value.

Registration Properties

To register for this event, you must set the EventMethod Field property of the registration item 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

Remarks

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 parent folder of the item 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 that is associated with this event will prevent the item from being deleted. If you abort an event that is the result of a move, 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.

For more information, see Synchronous Event Methods and Working with Synchronous Events.