Platform SDK: Exchange 2000 Server

Implementing an OnSyncSave Event Sink

[This is preliminary documentation and subject to change.]

[Visual Basic]
Private Sub IExStoreSyncEvents_OnSyncSave(ByVal pEventInfo As Exoledb.IExStoreEventInfo, ByVal bstrURLItem As String, ByVal lFlags As Long)

    Dim fso As Object
    Dim WinTmpFile As String
    Dim OnSyncSaveFile
    Dim Msg_Str As String
    Dim Prefix_Val
    Dim Suffix_Val
    Dim Msg_Str_New As String
    Dim DispInfo As IExStoreDispEventInfo
    Dim NewRec As Record
    
    Set DispInfo = pEventInfo
    
'log file
    WinTmpFile = Environ("SystemDrive") & "\SinkLogs\VBOnSyncSave.log"
       

'Create & Instantiate file system object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set OnSyncSaveFile = fso.OpenTextFile(WinTmpFile, 8, True)

'File Ops
    OnSyncSaveFile.WriteLine ("[VB Event Sink]       OnSyncSave()")
    OnSyncSaveFile.WriteLine ("  URL Item:           " & bstrURLItem)
    OnSyncSaveFile.WriteLine ("  lFlags:             " & "0x" & Hex(lFlags))
    OnSyncSaveFile.WriteBlankLines (1)
 
 
    'Case EVT_SYNC_BEGIN | EVT_NEW_ITEM
    If lFlags = 16777217 Then
        Prefix_Val = InStr(bstrURLItem, "VBOnSyncSave__Abort__")
        If Prefix_Val > 0 Then
            Call DispInfo.AbortChange
        End If
        OnSyncSaveFile.Close
        Set fso = Nothing
    End If
    
    'Case EVT_SYNC_BEGIN
    If lFlags = 16777216 Then
        OnSyncSaveFile.Close
        Set fso = Nothing
    End If
    
    'Case: EVT_SYNC_ABORTED | EVT_NEW_ITEM
    If Flags = 67108865 Then
        OnSyncSaveFile.Close
        Set fso = Nothing
    End If
    
    
    'Case EVT_SYNC_COMMITTED phase
    If ((lFlags = 33554433) Or (lFlags = 33554435) Or (lFlags = 33554432)) Then
        Set NewRec = DispInfo.EventRecord
        OnSyncSaveFile.WriteLine ("  Displayname:         " & NewRec.Fields("DAV:displayname").Value)
        Msg_Str = NewRec.Fields("DAV:displayname").Value
        OnSyncSaveFile.Close
        Set fso = Nothing
    End If
    
    Set DispInfo = Nothing
    
End Sub