This step-by-step article describes how to access an event registration item from a store event method.
An event registration item is stored as a hidden item in the folder in which the corresponding event sink is registered, and can be opened as an ActiveX Data Objects (ADO) record. It is possible to obtain the event registration item from within the store event sink.
Access an Event Resigtration Item from a Store Event Method
None of the store events expose the event registration item directly. However, most of them allow access to the URL of the event registration item, which can be used to open an ADO record. The event method that you are using determines how you obtain this URL.
The methods are as follows:
- OnTimer
The URL to the registration item is passed to the OnTimer event as a string. In the following code, the bstrURLItem parameter is the URL to the registration item.
Private Sub IExStoreSystemEvents_OnTimer( _
ByVal bstrURLItem As String, _
ByVal lFlags As Long)
- OnSave, OnDelete, OnSyncSave, or OnSyncDelete
To use one of these methods, follow these steps:
- Cast the IExStoreEventInfo pointer that is passed to these events as an IExStoreRegistrationURL item.
- Get the URL for the registration item from the EventRegistrationURL property of the IExStoreRegistrationURL item.
Private Sub IExStoreAsyncEvents_OnSave( _
ByVal pEventInfo As Exoledb.IExStoreEventInfo, _
ByVal bstrURLItem As String, _
ByVal lFlags As Long)
Dim oRegistrationURL As Exoledb.IExStoreRegistrationURL
Dim strRegItemURL As String
' Cast pEventInfo as an IExStoreRegistrationURL item.
Set oRegistrationURL = pEventInfo
' Get the EventRegistrationURL property from this item.
strRegItemURL = oRegistrationURL.EventRegistrationURL
End Sub
- OnMDBStartUp or OnMDBShutDown
The URL to the registration item is not exposed by anything that is passed to these event methods.