Attribute VB_Name = "mUtils"
'// Case EVT_SYNC_COMMITTED (&H2000000)
'// Case EVT_SYNC_COMMITTED (&H2000000) || EVT_NEW_ITEM (&H1)
'// Case EVT_SYNC_COMMITTED (&H2000000) || EVT_MOVE (&H100)
'// Case EVT_SYNC_COMMITTED (&H2000000) || EVT_COPY (&H200)
'// Above flags are only here as examples

'// Struct containing data extracted from the Item URL
'// that triggered the sink.

Public Type SinkUserData
    strPrefix           As String
    strUserDNSDomain    As String
    strMBX              As String
    strUserName         As String
    strFolderName       As String
    strItem             As String
End Type

Function ParseURL(strURL As String, UserData As SinkUserData)

    Dim strPrefix   As String
    Dim strChar     As String
    
    Dim intURLLen   As Integer
    Dim intCharPos  As Integer
    Dim intSepPos   As Integer

    Dim StrArray()  As Variant
    
    '// Assume backofficestorage file: URL
    intURLLen = Len(strURL)
    strPrefix = Mid(strURL, 1, Len("file://./backofficestorage/"))
    
    intSepPos = 0
    ReDim Preserve StrArray(intSepPos)
    For intCharPos = Len(strPrefix) + 1 To intURLLen
        strChar = Mid(strURL, intCharPos, 1)
        If strChar = "/" Then
            intSepPos = intSepPos + 1
            ReDim Preserve StrArray(intSepPos)
        Else
            StrArray(intSepPos) = StrArray(intSepPos) + strChar
        End If
    Next
    
    With UserData
        .strPrefix = strPrefix
        .strUserDNSDomain = StrArray(0)
        .strMBX = StrArray(1)
        .strUserName = StrArray(2)
        .strFolderName = StrArray(3)
        .strItem = StrArray(4)
    End With
    
End Function



