Timers & Events:
Whenever we talk about the event sink and we plan to implement the event sink that should trigger within a specified time or interval, then we will go for onTimer Event sink.
Basically Timers have scope, in the same way as other events. With timers, however, no event occurs in that location to cause the specified event to occur (such as a save event or a delete event).
Note Scope does define a specific location for the registration event item, which can affect the security context of the event sink, and guarantees that the event will be deleted if the folder containing the timer event registration is deleted
The OnTimer method will be called after a specific interval of time. It can be called by using the IExStoreSystemEvents Interface, which is the part of EXOLEDB type library.
This method is called for the time or time interval specified in the registration item.
Note The store may not invoke this sink if the server is not running when the specified time elapses. For example, if a sink registers for notification at 11:00 A.M. and the service goes down at 10:55 A.M. and comes back up at 11:05 A.M., the sink may not be called.
Creating sample Event sink (Visual Basic):
In order to create the Event sink with the OnTimer method, we need to make use of IEXStoreSystemEvents Interface like,
- Here, bstrURLItem - refers URL to the event registration item; lFlags - Get more information as specified in the article or refer this blog post or you can refer the EVT_INITNEW event sink flag. This flag is set at the first firing of the event. (Useful for initialization purposes. It is set only once during the lifetime of a created event sink.)
Note The bit flags are implemented in EXEVTSNK.TLB, which is installed with the Exchange Software Development Kit (SDK), and are passed through the LFLAGS parameter of the any one of the Exchange store event interface method.
Code Snippet(Visual Basic):
Registering Event sink: