VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Class1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Implements Exoledb.IExStoreSyncEvents
Private Sub IExStoreSyncEvents_OnSyncSave(ByVal pEventInfo As IExStoreEventInfo, ByVal bstrURLItem As String, ByVal lFlags As Long)
    Dim msg As New CDO.Message
    Dim lAttCount As Long
    Dim p As New CDO.Person
    Dim bp As IBodyPart
    Dim strContactsFolder As String
    Dim strContactURL As String
    Dim i As Integer
    Dim str As Stream
            
    strContactsFolder = Left(bstrURLItem, InStr(bstrURLItem, "/Inbox")) & "Contacts/"
    
    msg.DataSource.Open bstrURLItem, , adModeRead
    
    lAttCount = msg.Attachments.Count
    
    For i = 1 To lAttCount
        Set bp = msg.Attachments(i)
        If (bp.ContentMediaType = "text/x-vcard") Then
            Set str = p.GetVCardStream
            bp.GetDecodedContentStream.CopyTo str
            str.Flush
        End If
        
        strContactURL = strContactsFolder & p.LastName & p.FirstName & ".eml"
        p.DataSource.SaveTo strContactURL, , adModeReadWrite, adCreateOverwrite
    Next i
    
End Sub

Private Sub IExStoreSyncEvents_OnSyncDelete(ByVal pEventInfo As IExStoreEventInfo, ByVal bstrURLItem As String, ByVal lFlags As Long)
    
End Sub

