Imports System
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports Microsoft.Exchange.Transport.EventInterop
Imports Microsoft.Exchange.Transport.EventWrappers
Namespace SampleManagedSink
' For more information about the GUID, see step 10.
<Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")>Public Class ExchSinkClass
Implements IMailTransportSubmission, IEventIsCacheable
Public Sub IsCacheable() _
Implements IEventIsCacheable.IsCacheable
End Sub
Public Sub OnMessageSubmission(ByVal pIMailMsg As Microsoft.Exchange.Transport.EventInterop.MailMsg, ByVal pINotify As Microsoft.Exchange.Transport.EventInterop.IMailTransportNotify, ByVal pvNotifyContext As System.IntPtr) _
Implements IMailTransportSubmission.OnMessageSubmission
Try
Dim sSource As String = "Sample dotNET Exchange Sink Library"
Dim sLog As String = "Application"
Dim sEvent As String = "Sample dotNET Exchange Sink was triggered."
If (Not EventLog.SourceExists(sSource)) Then EventLog.CreateEventSource(sSource, sLog)
EventLog.WriteEntry(sSource, sEvent)
Catch
' Put some code here to handle errors.
' Currently, any error will just be ignored.
Finally
End Try
End Sub
End Class
End Namespace