Siebel Config: Outlook Form VBScript Codes

'************************************************************************************************
' This script traps Open, Send, Close events to update the database if necessary.
'
' The following user properties are passed:
'    ConnectString, ActivityID, LanguageCode, Debug, EnableActivityCreation, TempDir,
'    SiebelExtMailClientAttDir
'
' Revision History
'
' 06/11/2002        added multiple languages support
' 06/14/2002        added error handling for CompleteEmail
' 06/21/2002        added code for the draft problem
' 06/24/2002        added more languages support
' 06/24/2002        added code for CDO support. CDO triggers another security
'                       warning. If click No, addresses will not be updated.
' 06/11/2002        added CHT, CHS, KOR and other second tiers languages
' 09/09/2002        added CDO support for Distribution list.
'                       added code so that CDO will be used instead of setting the CDO flag
' 10/01/2002        added code to support distribution on the server
' 11/21/2002 V2.1       labeled v2.1
' 01/07/2002 V2.1.1     added code to use EditorType to determine the format of email to
'                       update the database
' 02/19/2002 v2.1.2     Added code to handle EditorType=RichText and HTMLBody is empty
' 04/23/2003 v2.2       Corrected the JPN, CHT, CHS and KOR encoding problem.  Now the error messages in double byte characters will be corrected
' 10/28/2003 v2.3       Added the check for Email format and then change the Form format accordingly
' 10/30/2003 v2.4        Added the check for No Email,Multiple Contact with control to display warning messges. added code to resolve multiple contacts with same email id issue
' 12/10/2003 v3.0       7.7 release.  Adding new error messages and also support the display of multiple matched and non matched contacts.
' 02/18/2004 v3.1       Modified the creation of Attachment Name as Unix kernel is not able to understand some unicode characters. Also simplified code into functions.
'************************************************************************************************

Dim g_bSent
Dim g_bDebug
Dim g_Outlookmsg(16)
Dim g_errMsg
Dim g_debugNote
Dim g_bUpdateAddress
Dim g_bCopyAndSend
Dim g_strConnectString
Dim g_strActivityId
Dim g_strDraftItem
Dim g_bUseCDO
Dim g_bUseUserPreferredFormat
Dim g_checkMatch
Dim g_bDisplayMatches
Dim g_bResolveMatches

'***************************************************************************************
' Constants
'***************************************************************************************
CdoPR_EMAIL = &H39FE001E

'***************************************************************************************
' Modify these parameters to change behavior
'***************************************************************************************
g_bUpdateAddress          = True
g_bCopyAndSend            = False
g_strDraftItem            = "DRAFT_ITEM"
g_bUseCDO                 = True
g_bUseUserPreferredFormat = FALSE
g_checkMatch          = False
g_bDisplayMatches         = False
g_bResolveMatches         = True

'***************************************************************************************
' Purpose: Log information into a file if possible
'***************************************************************************************
Sub LogDebug (strDebug)
   If g_bDebug Then
      g_debugNote.Body = g_debugNote.Body + strDebug + vbNewLine
   End If
End Sub

'***************************************************************************************
' Purpose: Setting property value
' Inputs: objPropArg: Property set object
'         strName: Name of the property to be set
'         strValue: Value of the property to be set
'***************************************************************************************
Function SetPropertyValue(objPropArg, strName, strValue)
   bOK = objPropArg.SetProperty(strName, strValue)
   SetPropertyValue = bOK

   LogDebug "Setting Property(" + strName + "," + strValue + ")"
End Function

'*****************************************************************************************
' Purpose: Ask user when non-fatal error happens
'          Show warning message with OK/Cancel buttons
'          Should ask the use if he wants to continue with Yes/No button.
' Inputs: strMsg: Propmt message
' Outputs: True/False, if false, g_errMsg contains the error message.
'*****************************************************************************************
Function ShowAttachmentErrorDialog (strMsg)
   LogDebug strMsg
   status = MsgBox (strMsg, 1)

   ' User clicks "OK", continue
   If status = 1 Then
      LogDebug "User chose to ignore the error"
      g_errMsg = ""
      ShowAttachmentErrorDialog = True
   Else
      LogDebug "User chose not to update the activity"
      g_errMsg = strMsg ' g_Outlookmsg(6)
      ShowAttachmentErrorDialog = False
   End If
End Function

'*****************************************************************************************
' Purpose: Updates the database record if necessary
' Inputs: item: Mail item to be updated.
' Outputs: None, g_errMsg indicates error
'*****************************************************************************************
Function UpdateActivity (Item)
   Dim bIgnoreAttachments
   Dim strAttDir
   Dim strFileList
   Dim strDisplayFileList
   Dim strToList
   Dim strCcList
   Dim strBccList
   Dim strContactList
   Dim DistremailAddress
   Dim bNoPreferredBody
   Dim strBody
   Dim strFormat
   Dim strFullAddressList
   Dim strMsg
   Dim strMultipleMatch

   On Error Resume Next
   Err = 0
   g_errMsg = ""

   ' Check draft item, obtained in Item_Open()
   If g_strActivityId = g_strDraftItem Then
      LogDebug "This is a draft item, skip UpdateActivity"
      Exit Function
   End If

   ' Check "ConnectString", obtained in Item_Open()
   If g_strConnectString = "" Then
      g_errMsg = g_Outlookmsg(0)
      LogDebug g_errMsg
      Exit Function
   End If

   ' Check "ActivityID", obtained in Item_Open()
   If g_strActivityId = "" Then
      g_errMsg = g_Outlookmsg(4)
      LogDebug g_errMsg
      Exit Function
   End If

   ' Check "EnableActivityCreation"
   Set propCreateActivity = Item.UserProperties ("EnableActivityCreation")
   If propCreateActivity Is Nothing Then
      g_errMsg = ""
      LogDebug g_Outlookmsg(1)
      Exit Function
   End If

   If propCreateActivity.Value <> "TRUE" Then
      g_errMsg = ""
      LogDebug "EnableActivityCreation is not set to TRUE, no activity update."
      Exit Function
   End If

   ' Check "SiebelExtMailClientAttDir"
   bIgnoreAttachments = False
   Set oAttDir = Item.UserProperties ("SiebelExtMailClientAttDir")
   If (oAttDir is Nothing OR oAttDir.Value = "") Then
      bIgnoreAttachments = True
      strAttDir = ""
      If Item.Attachments.Count > 0 Then
         strMsg = g_Outlookmsg(5) + " " + g_strActivityId + "."
         bContinue = ShowAttachmentErrorDialog (strMsg)
         If Not bContinue Then
            Exit Function
         End If
      End If
   Else
      strAttDir = oAttDir.Value
   End If
   LogDebug "SiebelExtMailClientAttDir: " + strAttDir

   ' Now, prepare to update the activity record

   LogDebug "Get Siebel.Desktop_Integration_Application.1"
   Set oApp = GetObject ("", "Siebel.Desktop_Integration_Application.1")
   If oApp Is Nothing Then
      g_errMsg = g_Outlookmsg(2)
      Exit Function
   End If

   If Not oApp.IsReady Then
      g_errMsg = g_Outlookmsg(3)
      Set oApp = Nothing
      Exit Function
   End If

   Set oInProp  = oApp.NewPropertySet
   Set oOutProp = oApp.NewPropertySet
   If (oInProp is Nothing OR oOutProp is Nothing) Then
      g_errMsg = g_Outlookmsg(8)
      Set oInProp = Nothing
      Set oOutProp = Nothing
      Set oApp = Nothing
      Exit Function
   End If

   ' Save attachments to the temporary directory

   bOK = SetPropertyValue (oInProp, "DeleteExistingAttachments", "TRUE")

   If Not bIgnoreAttachments Then
      strFileList = ""
      strDisplayFileList = ""

      inptr = InStr (strAttDir, ";")
      If inptr <> 0 Then
         strClientAttDir = Mid (strAttDir, 1, inptr-1)
         strServerAttDir = Mid (strAttDir, inptr+1, Len(strAttDir))
      Else
         strClientAttDir = strAttDir.Value
         strServerAttDir = strAttDir.Value
      End If
      For i = 1 To Item.Attachments.Count
         strFileNameClient = strClientAttDir + "/" + g_strActivityId + "_"&i
         strFileNameServer = strServerAttDir + "/" + g_strActivityId + "_"&i
         LogDebug "Attach file: " + strFileNameClient
         ' File operation may fail
         Err = 0
         Item.Attachments.Item(i).SaveAsFile (strFileNameClient)
         If Err = 0 Then
            strFileList = strFileList + strFileNameServer + ";"
            strDisplayFileList = strDisplayFileList + Item.Attachments.Item(i).DisplayName +  ";"
         Else
            strMsg = strFileNameClient + ": " + Err.Description + g_Outlookmsg(10)
            Err.Clear
            bContinue = ShowAttachmentErrorDialog (strMsg)
            If Not bContinue Then
               Exit Function
            End If
         End If
      Next

      If strFileList <> "" Then
         bOK = SetPropertyValue (oInProp,"AttachmentFileNames", strFileList)   
         bOK = SetPropertyValue (oInProp,"AttachmentFileDisplayNames", strDisplayFileList)
      End If
   End If

   ' Collect address information, this triggers security warning

   If g_bUpdateAddress Then
      strToList = ""
      strCcList = ""
      strBccList = ""
      strContactList = ""
    strFullAddressList = ""
      '
      ' First, try to use CDO to get the recipient email addresses in SMTP format
      '
      Set oSession = Nothing
      If g_bUseCDO Then
         Set oSession = CreateObject ("MAPI.Session")

         If Not oSession Is Nothing Then
            ' Logon
            oSession.Logon "", "", False, False, 0

            Set oRecipients = Item.Recipients

            For Each oRecipient In oRecipients
              Set oAddrEntry = oRecipient.AddressEntry

              emailAddress = oAddrEntry.Address
          fullName  = oAddrEntry.Name
              If (emailAddress <> "") And (Left(emailAddress, 3) = "/o=") Then
             ' check whether this is a Global Distribution list
             DistremailAddress = GetGlobalDistributionList(oSession, oAddrEntry.Name)
             ' If it is empty,  the given name is not a group
                 if DistremailAddress <> "" Then
                     emailAddress = DistremailAddress
                 else

                    ' Address id
                    addrEntryId = oAddrEntry.ID

                    If addrEntryId <> "" Then
                       emailAddress =  oSession.GetAddressEntry(addrEntryId).Fields(CdoPR_EMAIL).Value
                 fullName     =  oSession.GetAddressEntry(addrEntryId).Fields(CdoPR_DISPLAY_NAME).Value

                       If emailAddress = "" Then
                          emailAddress = oAddrAddress.Name
                       End If
                    Else
                       emailAddress = oAddrEntry.Name
                    End If
            End If
                  If Left(emailAddress, 3) = "/o=" Then
                     emailAddress = oAddrEntry.Name
                  End If
               Else
            ' possibly a Distribution List
                  if (oAddrEntry.Name <> "") Then
                     emailAddress = GetDistributionList(oSession, oAddrEntry.Members)
                  End if
               End If

               If emailAddress <> "" Then
                 recipType = oRecipient.Type
             If fullName <> "" Then
                     fullAddress = fullName + "<" + emailAddress + ">"
             Else
                 fullAddress = emailAddress
             End If
             If strFullAddressList <> ""  Then
               strFullAddressList = strFullAddressList + ";" + fullAddress
             Else
               strFullAddressList = fullAddress
             End If

                 If recipType = "1" Then
                     If strToList <> "" Then
                        strToList = strToList + ";" + emailAddress
                     Else
                        strToList = emailAddress
                     End If
                  ElseIf recipType = "2" Then
                     If strCcList <> "" Then
                        strCcList = strCcList + ";" + emailAddress
                     Else
                        strCcList = emailAddress
                     End If
                  ElseIf recipType = "3" Then
                     If strBccList <> "" Then
                        strBccList = strBccList + ";" + emailAddress
                     Else
                        strBccList = emailAddress
                     End If
                  End If
               End If
            Next

            Set oSession = Nothing
         End If
      End If

      If (strToList = "") And (Item.TO <> "") Then
         strToList = Item.TO
      End If

      If strToList <> "" Then
         bOK = SetPropertyValue (oInProp, "Field: Email To Line", strToList)
         strContactList = strToList
      End If

      If (strCcList = "") And (Item.CC <> "") Then
         strCcList = Item.CC
      End If

      If strCcList <> "" Then
         bOK = SetPropertyValue (oInProp, "Field: Email CC Line", strCcList)
         strContactList = strContactList + ";" + strCcList
      End If

      If (strBccList = "") And (Item.BCC <> "") Then
         strBccList = Item.BCC
      End If

      If strBccList <> "" Then
         bOK = SetPropertyValue (oInProp, "Field: Email BCC Line", strBccList)
         strContactList = strContactList + ";" + strBccList
      End If

      If strFullAddressList <> "" Then
       bOK = SetPropertyValue (oInProp, "ContactList", strFullAddressList)
      Else
           If strContactList <> "" Then
              bOK = SetPropertyValue (oInProp, "ContactList", strContactList)
       End If
      End If

      bOK = SetPropertyValue (oInProp, "Field: Email Sender Name",  Item.Session.CurrentUser.Name)

      bOK = SetPropertyValue (oInProp, "EnableContactAssoc", "TRUE")
      bOK = SetPropertyValue (oInProp, "DeleteExistingContacts", "TRUE")
   Else
      bOK = SetPropertyValue (oInProp, "EnableContactAssoc", "FALSE")
      bOK = SetPropertyValue (oInProp, "DeleteExistingContacts", "FALSE")
   End If
   bOK = SetPropertyValue (oInProp, "Field: Description", Item.Subject)
   ' Prepare to set email body and format
   strBody   = ""
   strFormat = "Plain Text"
   bNoPreferredBody = TRUE
   ' Try to get the email body based on user's preference first
   If g_bUseUserPreferredFormat Then
      Set oUserPreferredFormat = Item.UserProperties ("SiebelEmailFormat")

      If (Not oUserPreferredFormat Is Nothing) Then
         LogDebug "Format specified in the user preference: " & oUserPreferredFormat.Value
         If (oUserPreferredFormat.Value = "Plain Text") And (Item.Body <> "") Then
            bNoPreferredBody = FALSE
            strBody          = Item.Body
            strFormat        = "Plain Text"
         ElseIf (oUserPreferredFormat.Value = "HTML/Plain Text") And (Item.HTMLBody <> "") Then
            bNoPreferredBody = FALSE
            strBody          = Item.HTMLBody
            strFormat        = "HTML/Plain Text"
         End If
      Else
         LogDebug "Format specified in the user preference not passed to the script."
      End If
   End If

   ' Try to get the email body based on EditorType
   If bNoPreferredBody Then
      ' EditorType: UnSpecified = 0, Plain = 1, html = 2, RTF = 3, word = 4
      If Item.GetInspector.EditorType = 1 Then
         strBody   = Item.Body
         strFormat = "Plain Text"
      ElseIf Item.GetInspector.EditorType = 2 Then
         strBody   = Item.HTMLBody
         strFormat = "HTML/Plain Text"
      Else
         If (Item.HTMLBody <> "") Then
            strBody   = Item.HTMLBody
            strFormat = "HTML/Plain Text"
         Else
            strBody   = Item.Body
            strFormat = "Plain Text"
         End If
      End if
   End If
   bOK = SetPropertyValue (oInProp, "Field: Display Email Body", strBody)
   bOK = SetPropertyValue (oInProp, "Field: Email Format", strFormat)
   bOK = SetPropertyValue (oInProp, "Id", g_strActivityId)   
   bOK = SetPropertyValue (oInProp, "ConnectString", g_strConnectString)
   bOK = SetPropertyValue (oInProp, "ResolveContacts", g_bResolveMatches)

   ResolveMultiMatches oApp, oInProp, strFullAddressList, strContactList, oOutTempProp
   LogDebug "Get business service: Inbound E-mail Database Operations"
   Err = 0
   Set oBS = oApp.GetService ("Inbound E-mail Database Operations")
   If (Not oBS Is Nothing) And (Err = 0) Then
      LogDebug "Call method CompleteEmail"  
      bOK = oBS.InvokeMethod ("CompleteEmail", oInProp, oOutProp)

      If bOK Then
         ' Check Siebel error:
         '   "ExtErrorCode"           -contains the external error code illustrated in the sample  code
         '   "ErrorCode"              -contains the Siebel error code
         '   "ErrorMessage"           -contains the actual Siebel error message
         '   "Multiple Match Contact" -Contains the list of contacts that have multi matches in the database
         '   "No Match Contact"       -Contains the list of contacts that have no match in the database
         '
         'errCode = oOutProp.GetProperty ("ExtErrorCode")
         'Select Case errCode
         '   Case "1"
         '      MsgBox "ConnectString is not passed or empty"
         '   Case "2"
         '      MsgBox "ConnectString mismatch, connected to the wrong application"
         '   Case "3"
         '      MsgBox "Id is not passed"
         '   Case "4"
         '      MsgBox "Record with the specified id not found"
         '   Case "5"
         '      MsgBox "Failed to update the record"
         '   Case "6"
         '      MsgBox "Other error"
         'End Select
         '
         g_errMsg = oOutProp.GetProperty ("ErrorMessage")

         If g_errMsg = "" Then
            ' Check error object if any
            status = oOutProp.GetProperty ("Status")
            If (status = "Error") Then
               ' Get the error message
               count = oOutProp.GetChildCount ()
               For i=0 To count-1
                  Set oErrors = oOutProp.GetChild(i)
                  If (oErrors.GetType () = "Errors") Then
                     count2 = oErrors.GetChildCOunt ()
                     For j=0 To count2-1
                        Set oError = oErrors.GetChild (j)
                        errMsg = oError.GetProperty ("ErrMsg")
                        If (errMsg <> "") Then
                           If g_errMsg <> "" Then
                              g_errMsg = g_errMsg + vbNewLine + errMsg
                           Else
                              g_errMsg = errMsg
                           End If
                        End If
                     Next
                  End If
               Next
            End If
         End If

    If g_checkMatch Then
         If g_bDisplayMatches <> "True" Then
       strMultipleMatch = oOutTempProp.GetProperty ("Multiple Match Contact")
         If strMultipleMatch <> "" Then
        strMsg = g_Outlookmsg(11) + " " + strMultipleMatch
        MsgBox strMsg
       End If
         End If
         strNoMatch      = oOutTempProp.GetProperty ("No Match Contact")
       If strNoMatch <> "" Then
            strMsg = g_Outlookmsg(12) + " " + strNoMatch
        MsgBox strMsg
       End If
      End If

      Else
         ' COM error
         g_errMsg = oBS.GetLastErrText ()
         If g_errMsg = "" Then
            g_errMsg = g_Outlookmsg(6)
         End If
      End If
   Else
      If Err <> 0 Then
         g_errMsg = Err.Description
      Else
         g_errMsg = g_Outlookmsg(6)
      End If
   End If
End Function

'******************************************************************************************* *
' Purpose: Delete the activity record when an email is cancelled
' Inputs: strActivityId: The id of the activity record to be deleted.
' Outputs: None, g_errMsg indicates error.
'******************************************************************************************* *
Function DeleteActivity (strActivityId)
   On Error Resume Next
   Err = 0
   g_errMsg = ""

   ' Check draft item, obtained in Item_Open()
   If g_strActivityId = g_strDraftItem Then
      LogDebug "This is a draft item, skip DeleteEmail"
      Exit Function
   End If

   ' Check "ConnectString", obtained in Item_Open()
   If g_strConnectString = "" Then
      LogDebug "ConnectString is empty"
      Exit Function
   End If

   Set oApp = GetObject ("", "Siebel.Desktop_Integration_Application.1")
   If Not oApp Is Nothing Then
      If oApp.IsReady Then
         Set oInProp = oApp.NewPropertySet
         Set oOutProp = oApp.NewPropertySet
         If Not (oInProp is Nothing or oOutProp is Nothing) Then
            If strActivityId <> "" Then
               bOK = SetPropertyValue (oInProp, "Id", g_strActivityId)
               bOK = SetPropertyValue (oInProp, "ConnectString", g_strConnectString)
               bOK = SetPropertyValue (oInProp, "BusObj", "Mail Agent Activity")
               bOK = SetPropertyValue (oInProp, "BusComp", "Mail Agent Activity")

               Err = 0
               Set oBS = oApp.GetService ("Inbound E-mail Database Operations")
               bOK = oBS.InvokeMethod ("DeleteEmail", oInProp, oOutProp)

               If bOK Then
                  ' Check Siebel error
                  g_errMsg = oOutProp.GetProperty ("ErrorMessage")
               Else
                  ' COM error
                  g_errMsg = oBS.GetLastErrText ()
                  If g_errMsg = "" Then
                     g_errMsg = g_Outlookmsg(6)
                  End If
               End If
            End If 
         Else
            g_errMsg = g_Outlookmsg(8)
         End If
      Else
         g_errMsg = g_Outlookmsg(3)
      End if
   Else
      g_errMsg = g_Outlookmsg(2)
   End If

   If Err <> 0 Then
      If g_errMsg = "" Then
         g_errMsg = Err.Description
      Else
         g_errMsg = g_errMsg + Chr(13) + Err.Description
      End If

      Err.Clear
   End If
End Function

'***************************************************************************************
' Purpose: Copy attachments from one item to another
' Inputs: srcItem: The source item
'         dstItem: The destination item
' Outputs: None
'***************************************************************************************
Function CopyAttachments(srcItem, dstItem, tempDir)
   Dim tmpDir
   Dim tmpFile

   Set oFS = CreateObject("Scripting.FileSystemObject")

   If tempDir = "" Then
      Set oFldTmp = oFS.GetSpecialFolder(2)
      tmpDir = oFldTmp.Path & "/"
      Set oFldTmp = Nothing
   Else
      tmpDir = tempDir
   End If
   For Each oAtt In srcItem.Attachments
      tmpFile = tmpDir + oAtt.FileName
      oAtt.SaveAsFile tmpFile
      dstItem.Attachments.Add tmpFile, 1, , oAtt.DisplayName
      oFS.DeleteFile tmpFile
   Next

   Set oFS = Nothing
End Function

'***************************************************************************************
' Purpose: Creates a new mail item with the regular form, copies the data over
'          and send it.
' Inputs: item: The mail item to be copied.
' Outputs: None
'***************************************************************************************
Function SendMailWithRegularForm(item)
   Dim newMail
   Dim tempDir
   Dim propTempDir
   Dim propActivityId
   Dim versionMajor

   On Error Resume Next

   Set newMail = Application.CreateItem(0)
'
' Copy properties from item
' Copy frequently used properties first
'
   With newMail
      .BCC = item.BCC
      .Body = item.Body
      .CC = item.CC
      .Subject = item.Subject
      .To = item.To
      .HTMLBody = item.HTMLBody
      .Importance = item.Importance
   End With
   If Err <> 0 Then
      Exit Function
   End If
'
' Copy other important properties
'
   With newMail
      .AlternateRecipientAllowed = item.AlternateRecipientAllowed
      .Categories = item.Categories
      .Companies = item.Companies
      .DeleteAfterSubmit = item.DeleteAfterSubmit
      .ExpiryTime = item.ExpiryTime
      .FlagDueBy = item.FlagDueBy
      .FlagRequest = item.FlagRequest
      .FlagStatus = item.FlagStatus
      .NoAging = item.NoAging
      .ReminderOverrideDefault = item.ReminderOverrideDefault
      .ReminderSet = item.ReminderSet
      .ReminderPlaySound = item.ReminderPlaySound
      .ReminderSoundFile = item.ReminderSoundFile
      .ReminderTime = item.ReminderTime
      .Sensitivity = item.Sensitivity
   End With
'
' Copy 2002 properties
'
   With newMail
      .BodyFormat = item.BodyFormat
      .InternetCodePage = item.InternetCodePage
   End With
   If Err <> 0 Then
      Err.Clear
      Err = 0
   End If
'
' Copy attachments
' Save to a temp directory first
'
   If item.Attachments.count > 0 Then
      Set propTempDir = item.UserProperties("TempDir")
      If Not propTempDir Is Nothing Then
         tempDir = propTempDir.Value
      End If

      If g_strActivityId <> "" Then
         tempDir = tempDir + g_strActivityId + "_"
      End If

      CopyAttachments item, newMail, tempDir
   End If
'
' Send the mail
'
   newMail.Send

   Set newMail = Nothing
End Function

'*******************************************************************************************
' Purpose: Handler for Open event
' Inputs: None
' Outputs: True
'*******************************************************************************************
Function Item_Open()
'
' This function does the variables initialization.
' It also initializes different error message.  Localization can be done here
'
   g_bSent   = False
   g_bDebug  = False
   g_errMsg  = ""

   Set propLanguage = Item.UserProperties ("LanguageCode")

   If propLanguage Is Nothing Then
      userLang = "ENU"
   Else
      userLang = propLanguage.Value
   End If

   Select case userLang
   case "CSY"
    g_OutlookMsg(0) = "Pripojovací retezec databáze není k dispozici.   Aktualizace záznamu o aktivite nebude provedena.  Obratte se na správce systému."
    g_OutlookMsg(1) = "Není nastaven príznak Povolit vytvorení aktivity.   Aktualizace záznamu o aktivite nebude provedena.  Obratte se na správce systému."
    g_OutlookMsg(2) = "Nelze vytvorit objekt HTML Siebel.  Pozádejte správce  systému o overení, zda je povolen objekt Siebel Web Automation."
    g_OutlookMsg(3) = "Objekt HTML Siebel není pripraven, restartujte webovou  aplikaci.  Pokud bude problém pretrvávat, obratte se na správce systému."
    g_OutlookMsg(4) = "Systém Siebel neposkytl ID aktivity.  Aktualizace záznamu  o aktivite nebude provedena.  Obratte se na správce systému."
    g_OutlookMsg(5) = "Není zadán adresár príloh.  Prílohy aktivity nebudou  vytvoreny."
    g_OutlookMsg(6) = "Záznam o aktivite nebyl úspešne aktualizován.  Pozádejte  správce systému o kontrolu údaju v souboru protokolu serveru Siebel."
    g_OutlookMsg(7) = "Došlo k potízím pri pokusu o aktualizaci záznamu o  aktivite.  Zkopírujte následující chybovou zprávu a pozádejte správce systému o pomoc."
    g_OutlookMsg(8) = "Chyba pri vytvárení objektu vlastnosti. Obratte se na  správce systému."
    g_Outlookmsg(9) = "Došlo k chybe pri aktualizaci záznamu aktivity. Chcete pokracovat v odesílání e-mailové zprávy?"
       g_Outlookmsg(10) = "Chcete pokracovat v aktualizaci záznamu o aktivite?"
        g_Outlookmsg(11) = "Pro vybrané kontakty existuje více shod. Aktivita bude aktualizována pro první nalezený záznam kontaktu. Kontakty k dispozici:"
        g_Outlookmsg(12) = "Pro žádný kontakt, na který jste odeslali e-mail, nebyla nalezena shoda. Aktivitu nelze aktualizovat pro žádný záznam kontaktu. Zadali jste e-mailové adresy:"

   case "CHS"
    g_OutlookMsg(0) = "Êý¾Ý¿âÁ½Ó×Ö•û´®²»¿ÉÓá£ÎÞ•¨Íê³É¸üлǼ¡£ÇëÓë¹ÜÀíÔ±ÁªÏµ¡£"
    g_OutlookMsg(1) = "δÉèÖÃÆôÓû´½¨±êÖ¾¡£ÎÞ•¨Íê³É¸üлǼ¡£ÇëÓë¹ÜÀíÔ±ÁªÏµ¡£"
    g_OutlookMsg(2) = "ÎÞ•¨´´½¨ Siebel HTML ÔÏó¡£ÇëÓë¹ÜÀíÔ±ÁªÏµ£ÒÔÑéÖ¤ Siebel  Web ×Ô¯»¯ÔÏóÒÑÆôÓá£"
    g_OutlookMsg(3) = "Siebel HTML ÔÏóδ׼±¸¾ÍÐ÷¡£ÇëÖØÐÂÆô¯ Web  Ó¦ÓóÌÐò¡£Èç¹ûÎÊÌâÈÔÈ»´æÔÚ£ÇëÓë¹ÜÀíÔ±ÁªÏµ¡£"
    g_OutlookMsg(4) = "Siebel ÖÐδÌṩ»î¯ ID  ¡£ÎÞ•¨Íê³É¸üлǼ¡£ÇëÓë¹ÜÀíÔ±ÁªÏµ¡£"
    g_OutlookMsg(5) = "δÌṩ¸½¼þĿ¼¡£ÏµÍ³½«²»»áΪ´Ë»î¯´´½¨¸½¼þ¡£"
    g_OutlookMsg(6) = "δÄܳɹ¦¸üлǼ¡£ÇëÓë¹ÜÀíÔ±ÁªÏµ£¼ì²é Siebel  •þÎñÆ÷ÈÕÖ¾ÎļþÐÅÏ¢¡£"
    g_OutlookMsg(7) = "³¢ÊÔ¸üлǼʱ³öÏÖÎÊÌâ¡£Ç븴ÖÆÒÔÏ´íÎóÏûÏ¢£²¢×Éѯ¹ÜÀíÔ±£ÒÔ»ñµÃ°ïÖú¡£"
    g_OutlookMsg(8) = "´´½¨ÊôÐÔÔÏóʱ³öÏÖ´íÎó¡£ÇëÓë¹ÜÀíÔ±ÁªÏµ¡£"
    g_Outlookmsg(9) = "¸üлǼʱ³ö´í¡£ÊÇ•ñ¼ÌÐø•¢Ë͵ç×ÓÓʼþ£¿"
       g_Outlookmsg(10) = "ÊÇ•ñ¼ÌÐø¸üлǼ£¿"
        g_Outlookmsg(11) = "´æÔÚà¸öÓëÑ¡¨µÄÁªÏµÈËÆ¥ÅäµÄÏϵͳ½«ÎªµÚÒ»¸ö¿ÉÓÃÁªÏµÈ˼Ǽ¸üд˻£ÁªÏµÈËΪ£º"
        g_Outlookmsg(12) = "ûÓÐÏîÄ¿Óë×÷ΪÓʼþ½ÓÊÕÈ˵ÄÈκÎÁªÏµÈËÆ¥Å䡣ϵͳÎÞ•¨ÎªÈκÎÁªÏµÈ˼Ǽ¸üд˻£ÄúÊäÈëµÄµç×ÓÓʼþµØÖ•ÈçÏ£º"
   case "CHT"
    g_OutlookMsg(0) = "µLªk¨Ï¥Î¸ê®Æ®w³s±µ¦r¦ê¡C¬¡°Ê°O¿ý±N¤£·|§ó·s¡C½Ð»PºÞ²z­ûÁpµ¸¡C"
    g_OutlookMsg(1) = "©|¥¼³]©w¡u±Ò¥Î¬¡°Ê«Ø¥ß¡vºX¼Ð¡C¬¡°Ê°O¿ý±N¤£·|§ó·s¡C½Ð»PºÞ²z­ûÁpµ¸¡C"
    g_OutlookMsg(2) = "µLªk«Ø¥ß Siebel HTML ª«¥ó¡C½Ð»PºÞ²z­ûÁpµ¸¥H½T»{¡uSiebel  Web ¦Û°Ê¤Æª«¥ó¡v¬O§_¤w±Ò¥Î¡C"
    g_OutlookMsg(3) = "Siebel HTML ª«¥ó©|¥¼´Nºü¡C½Ð­«·s±Ò°Ê Web  À³¥Îµ{¦¡¡C¦pªG°ÝÃD¤´µM¦s¦b¡A½Ð¬¢¸ßºÞ²z­û¡C"
    g_OutlookMsg(4) = "©|¥¼³z¹L Siebel ´£¨Ñ¬¡°Ê  ID¡C¬¡°Ê°O¿ý±N¤£·|§ó·s¡C½Ð»PºÞ²z­ûÁpµ¸¡C"
    g_OutlookMsg(5) = "©|¥¼´£¨Ñªþ¥ó¥Ø¿ý¡C±N¤£·|¬°¦¹¬¡°Ê«Ø¥ßªþ¥ó¡C"
    g_OutlookMsg(6) = "¬¡°Ê°O¿ý¥¼¦¨¥/§ó·s¡C½Ð»PºÞ²z­ûÁpµ¸¥HÀˬd Siebel  ¦øªA¾¹°O¿ýÀɮ׸ê°T¡C"
    g_OutlookMsg(7) = "¹Á¸Õ§ó·s¬¡°Ê°O¿ý®Éµo¥Í°ÝÃD¡C½Ð½Æ»s¤U¦C¿ù»~°T®§¨Ã¬¢¸ßºÞ²z­û¥H´M¨D¨ó§U¡C"
    g_OutlookMsg(8) = "«Ø¥ßÄݩʪ«¥ó®Éµo¥Í¿ù»~¡C½Ð»PºÞ²z­ûÁpµ¸¡C"   
    g_Outlookmsg(9) = "¦³¦hµ§¸ê®Æ²Å¦X±z©Ò¿ïªºÁpµ¸¤H¡C ¬¡°ÊÀ³¸Ó¦b²Ä¤@­Ó¥i¥Î°O¿ý¤W§ó·s¡C Ápµ¸¤H©m¦W¬O "
       g_Outlookmsg(10) = "¨S¦³¸ê®Æ²Å¦X±z±H¥X¶l¥ó¤W©Ò³]©wªºÁpµ¸¤H¡C ¬¡°ÊµLªk¦b¥ô¦ó°O¿ý¤W§ó·s¡C ±z¿é¤Jªº¹q¤l¶l¥ó¦a§}¬O "
        g_Outlookmsg(11) = "Do you want to continue to update the activity record?"
        g_Outlookmsg(12) = "Error occurred in updating the activity record. Do you want to continue to send the email?"

   case "ENU"
        g_Outlookmsg(0) = "Database connect string is not presented. Update will not be done."
         g_Outlookmsg(1) = "EnableActivityCreate Flag is not set. Update will not be done."  
         g_Outlookmsg(2) = "SiebelHTML object cannot be created. Please check whether the Siebel Web Automation Object is enabled."  
         g_Outlookmsg(3) = "SiebelHTML object is not ready. Please restart your web  application. If problem persists, please consult your administrator."
         g_Outlookmsg(4) = "ActivityID is not provided from Siebel. Update will not be  done."
         g_Outlookmsg(5) = "Attachment directory is not provided. Attachments will not be  created for activity"
         g_Outlookmsg(6) = "Update was not done successfully. Please check Siebel Server for errors."
         g_Outlookmsg(7) = "There is problem in carrying an activity update operation. Please copy the following error and ask your administrator for help."
         g_Outlookmsg(8) = "Error in creating Property Object."
        g_Outlookmsg(9) = "Error occurred in updating the activity record. Do you want to continue to send the email?"
        g_Outlookmsg(10) = "Do you want to continue to update the activity record?"
    g_Outlookmsg(11) = "There are multiple matches for the contact you selected. The activity shall be updated on the first available record. The name of the contact is "
    g_Outlookmsg(12) = "There is no match for the contact you sent mail. The activity cannot be updated on any record. The Email Address you typed is "

   case "DAN"
    g_OutlookMsg(0) = "Databasens forbindelsesstreng er ikke  tilgængelig.  Der vil ikke ske en opdatering til aktivitetsposten.  Kontakt  administratoren."
    g_OutlookMsg(1) = "Aktiver aktivitetsoprettelse - Markering er ikke  indstillet.  Der vil ikke ske en opdatering til aktivitetsposten.  Kontakt administratoren."
    g_OutlookMsg(2) = "Siebel HTML-objektet kan ikke oprettes.  Kontakt  administratoren for at få bekræftet, at Siebel-webautomatiseringsobjekt er aktiveret."
    g_OutlookMsg(3) = "Siebel HTML-objektet er ikke klar. Genstart  web-applikationen.  Hvis problemet fortsætter, skal du kontakte din administrator."
    g_OutlookMsg(4) = "Aktivitets-ID leveres ikke af Siebel.  Der vil  ikke ske en opdatering til aktivitetsposten.  Kontakt administratoren."
    g_OutlookMsg(5) = "Bilagsbibliotek er ikke blevet oplyst. Der vil  ikke blive oprettet bilag for aktiviteten."
    g_OutlookMsg(6) = "Aktivitetsposten blev ikke opdateret korrekt.   Kontakt administratoren for at kontrollere oplysningerne i Siebel-serverlogfilen."
    g_OutlookMsg(7) = "Der har været et problem under forsøget på at  opdatere aktivitetsposten.  Kopiér følgende fejlmeddelelse og konsultér administratoren for  hjælp."
    g_OutlookMsg(8) = "Der opstod en fejl under oprettelsen af  egenskabsobjekt. Kontakt administratoren."                
    g_Outlookmsg(9) = "Der opstod en fejl ved opdatering af aktivitetsposten. Vil du fortsætte med at sende e-mail?"
       g_Outlookmsg(10) = "Vil du fortsætte med at opdatere aktivitetsposten?"
        g_Outlookmsg(11) = "Der er flere forekomster til den eller de kontaktpersoner, som du valgte. Aktiviteten opdateres for den kontaktperson, der først er tilgængelig. Der er følgende kontaktpersoner:"
        g_Outlookmsg(12) = "Der er ingen forekomst til de kontaktpersoner, som du sendt en mail til. Aktiviteten kan ikke opdateres for nogen kontaktpersoner. Du har angivet følgende e-mail-adresser:"

   case "DEU"
    g_Outlookmsg(0) = "Connect-String für die Datenbank nicht verfügbar.   Der Aktivitätsdatensatz wird nicht aktualisiert.  Wenden Sie sich an Ihren Administrator."
    g_Outlookmsg(1) = "Es ist kein Flag zum Aktivieren der  Aktivitätserstellung gesetzt.  Der Aktivitätsdatensatz wird nicht aktualisiert.  Wenden Sie  sich an Ihren Administrator."
    g_Outlookmsg(2) = "Siebel HTML-Objekt kann nicht erstellt werden.   Wenden Sie sich an Ihren Administrator, um sicherzustellen, dass das Siebel  Web-Automatisierungsobjekt aktiviert ist."
    g_Outlookmsg(3) = "Siebel HTML-Objekt ist nicht bereit. Starten Sie  Ihre Web-Anwendung neu.  Wenden Sie sich an Ihren Administrator, falls das Problem weiterhin  besteht."
    g_Outlookmsg(4) = "Es wurde keine Aktivitäts-ID von Siebel gestellt.   Der Aktivitätsdatensatz wird nicht aktualisiert.  Wenden Sie sich an Ihren Administrator."
    g_Outlookmsg(5) = "Es wurde kein Anhangverzeichnis geliefert.  Für  die Aktivität wird kein Anhang erstellt."
    g_Outlookmsg(6) = "Der Aktivitätsdatensatz wurde nicht erfolgreich  aktualisiert.  Wenden Sie sich an Ihren Administrator, um die Daten der Siebel  Server-Protokolldatei zu prüfen."
    g_Outlookmsg(7) = "Beim Versuch, den Aktivitätsdatensatz zu  aktualisieren, wurde ein Fehler erfasst.  Kopieren Sie folgende Fehlerdaten, und bitten Sie  Ihren Systemadministrator um Unterstützung:"
    g_Outlookmsg(8) = "Fehler beim Erstellen des Eigenschaftsobjektes.  Wenden Sie sich an Ihren Administrator."
    g_Outlookmsg(9) = "Fehler beim Aktualisieren des Aktivitätsdatensatzes. Möchten Sie das Senden der E-Mail fortsetzen?"
       g_Outlookmsg(10) = "Möchten Sie die Aktualisierung des Aktivitätsdatensatzes fortsetzen?"
        g_Outlookmsg(11) = "Für die ausgewählten Kontakte wurden mehrere Übereinstimmungen gefunden. Die Aktivität wird mit dem ersten verfügbaren Kontaktdatensatz aktualisiert. Folgende Kontakte sind betroffen:"
        g_Outlookmsg(12) = "Es wurde keine Übereinstimmung für die Kontakte gefunden, denen Sie E-Mail zugestellt haben. Die Aktivität kann für keinen Kontaktdatensatz aktualisiert werden. Sie haben folgende E-Mail-Adressen eingegeben:"

   case "ESN"
    g_Outlookmsg(0) = "La cadena de conexión de la base de datos no está  disponible.  No se realizará la actualización del registro de actividades.  Póngase en  contacto con el administrador."
    g_Outlookmsg(1) = "No se ha definido el indicador Activar creación  de actividad.  No se realizará la actualización del registro de actividades.  Póngase en  contacto con el administrador."
    g_Outlookmsg(2) = "No se puede crear el objeto HTML de Siebel.   Póngase en contacto con su administrador para comprobar que el objeto de automatización web  de Siebel está activado."
    g_Outlookmsg(3) = "El objeto HTML de Siebel no está preparado.  Reinicie la aplicación web.  Si el problema persiste, póngase en contacto con su  administrador."
    g_Outlookmsg(4) = "ID de la actividad no proporcionada por Siebel.   No se realizará la actualización del registro de actividades.  Póngase en contacto con el  administrador."
    g_Outlookmsg(5) = "Debe indicar el directorio del archivo adjunto.   No se crearán archivos adjuntos para esta actividad."
    g_Outlookmsg(6) = "El registro de actividades no se ha actualizado  correctamente.  Póngase en contacto con el administrador para consultar la información del  archivo de registro de Siebel Server."
    g_Outlookmsg(7) = "Se ha producido un error al intentar actualizar  el registro de actividades.  Copie el mensaje de error siguiente y consulte a su  administrador para obtener ayuda."
    g_Outlookmsg(8) = "Error al crear el objeto de propiedades. Póngase  en contacto con el administrador."
    g_Outlookmsg(9) = "Se produjo un error al actualizar el registro de actividad. ¿Desea continuar enviando el mensaje de correo electrónico?"
       g_Outlookmsg(10) = "¿Desea continuar actualizando el registro de actividad?"
        g_Outlookmsg(11) = "Hay varias coincidencias para los contactos seleccionados. La actividad se actualizará para el primer registro de contacto disponible. Los contactos son los siguientes:"
        g_Outlookmsg(12) = "No hay ninguna coincidencia con ninguno de los contactos a los que envió correo. No se puede actualizar la actividad para ningún registro de contacto. Las direcciones de correo electrónico que introdujo son las siguientes:"

   case "FIN"
    g_OutlookMsg(0) = "Tietokannan yhteysmerkkijono ei ole  käytettävissä. Aktiviteettitietuetta ei päivitetä. Ota yhteys järjestelmänvalvojaan"
    g_OutlookMsg(1) = "Aktiviteetin lipun luomista ei ole otettu  käyttöön. Aktiviteettitietuetta ei päivitetä. Ota yhteys järjestelmänvalvojaan."
    g_OutlookMsg(2) = "Siebel HTML-objektia ei voi luoda. Ota yhteyttä  järjestelmänvalvojaan ja varmista, että Siebel Web -automaatio-objekti on käytössä."
    g_OutlookMsg(3) = "Siebel HTML-objekti ei ole valmis. Käynnistä  Web-sovellus uudelleen. Ota yhteyttä järjestelmänvalvojaan, jos ongelma toistuu."
    g_OutlookMsg(4) = "Aktiviteettitunnus ei ole Siebelin antama.  Aktiviteettitietuetta ei päivitetä. Ota yhteys järjestelmänvalvojaan."
    g_OutlookMsg(5) = "Liitehakemistoa ei ole annettu. Aktiviteetille ei  luoda liitteitä."
    g_OutlookMsg(6) = "Aktiviteettitietueen päivitys epäonnistui. Ota  yhteyttä järjestelmänvalvojaan ja pyydä häntä tarkistamaan Siebel Server -palvelimen  lokitiedoston tiedot."
    g_OutlookMsg(7) = "Havaittiin virhe yritettäessä päivittää  aktiviteettitietuetta. Kopioi seuraava virhesanoma ja pyydä apua järjestelmänvalvojalta."
    g_OutlookMsg(8) = "Virhe luotaessa ominaisuusobjektia. Ota yhteys  järjestelmänvalvojaan."
    g_Outlookmsg(9) = "Virhe päivitettäessä toimitietuetta. Haluatko jatkaa lähettämällä sähköpostiviestin?"
       g_Outlookmsg(10) = "Haluatko jatkaa päivittämällä toimitietueen?"
        g_Outlookmsg(11) = "Valitsemiasi yhteyshenkilöitä vastaavia kohteita löytyi useita. Ensimmäisen käytettävissä olevan yhteyshenkilötietueen toimi päivitetään. Yhteyshenkilöt ovat:"
        g_Outlookmsg(12) = "Postin vastaanottajaa ei vastaa yksikään yhteyshenkilö. Minkään yhteyshenkilötietueen toimea ei voitu päivittää. Syöttämäsi sähköpostiosoitteet:"

   case "FRA"
    g_Outlookmsg(0) = "La chaîne de connexion de base de données n'est  pas disponible.  La mise à jour de l'enregistrement d'activité ne sera pas effectuée.   Contactez votre administrateur."
    g_Outlookmsg(1) = "L'indicateur Autoriser la création d'activité  n'est pas défini.  La mise à jour de l'enregistrement d'activité ne sera pas effectuée.   Contactez votre administrateur."
    g_Outlookmsg(2) = "Impossible de créer l'objet HTML Siebel.   Contactez l'administrateur pour vérifier que l'objet d'automatisation Web Siebel est  activé."
    g_Outlookmsg(3) = "L'objet HTML Siebel n'est pas prêt. Redémarrez  votre application Web.  Si le problème persiste, contactez l'administrateur."
    g_Outlookmsg(4) = "ID d'activité non fournie par Siebel.  La mise à  jour de l'enregistrement d'activité ne sera pas effectuée.  Contactez votre administrateur."
    g_Outlookmsg(5) = "Répertoire de pièces jointes non fourni.  Les  pièces jointes ne seront pas créées pour l'activité."
    g_Outlookmsg(6) = "La mise à jour de l'enregistrement d'activité a  échoué.  Contactez votre administrateur pour vérifier les informations de l'historique du  serveur Siebel."
    g_Outlookmsg(7) = "Problème survenu au cours de la tentative de mise  à jour de l'enregistrement d'activité.  Copiez le message d'erreur suivant, puis consultez  votre administrateur pour obtenir de l'aide."
    g_Outlookmsg(8) = "Erreur de création de l'objet de propriété.  Contactez votre administrateur."
    g_Outlookmsg(9) = "Une erreur est survenue lors de la mise à jour de l'enregistrement d'activité. Voulez-vous quand même envoyer l'e-mail ?"
       g_Outlookmsg(10) = "Voulez-vous continuer à mettre à jour l'enregistrement d'activité ?"
        g_Outlookmsg(11) = "Il existe plusieurs correspondances pour le(s) interlocuteur(s) que vous avez sélectionné(s). L'activité sera mise à jour pour le premier enregistrement d'interlocuteur disponible. Les interlocuteurs sont :"
        g_Outlookmsg(12) = "Il n'y a de correspondance pour aucun des interlocuteurs auxquels vous avez envoyé un e-mail. L'activité ne peut être mise à jour pour aucun des enregistrements d'interlocuteur. Vous avez entré les adresses e-mail :"

   case "JPN"   
    g_OutlookMsg(0) = "ƒf[ƒ^ƒx[ƒXÚ‘±•Žš—ñ‚ªŽg—p‚Å‚«‚Ü‚¹‚ñBŠˆ“®ƒŒƒR[ƒh‚ւ̍XV‚͍s‚í‚ê‚Ü‚¹‚ñBŠÇ—ŽÒ‚ɘA—‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(1) = "Šˆ“®ì—LŒø‰»ƒtƒ‰ƒO‚ªÝ’肳‚ê‚Ä‚¢‚Ü‚¹‚ñBŠˆ“®ƒŒƒR[ƒh‚ւ̍XV‚͍s‚í‚ê‚Ü‚¹‚ñBŠÇ—ŽÒ‚ɘA—‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(2) = "Siebel HTML ƒIƒuƒWƒFƒNƒg‚ðì‚Å‚«‚Ü‚¹‚ñBŠÇ—ŽÒ‚ɘA—‚µ‚āASiebel Web  Ž©“®‰»ƒIƒuƒWƒFƒNƒg‚ª—LŒø‚É‚È‚Á‚Ä‚¢‚邱‚Æ‚ðŠm”F‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(3) = "Siebel HTML ƒIƒuƒWƒFƒNƒg‚̏€”õ‚ª‚Å‚«‚Ä‚¢‚Ü‚¹‚ñBWeb  ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ðÄ‹N“®‚µ‚Ä‚‚¾‚³‚¢B–â‘肪‰ðŒˆ‚³‚ê‚È‚¢ê‡‚́AŠÇ—ŽÒ‚ɘA—‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(4) = "Siebel ‚©‚犈“® ID  ‚ª”s‚³‚ê‚Ä‚¢‚Ü‚¹‚ñBŠˆ“®ƒŒƒR[ƒh‚ւ̍XV‚͍s‚í‚ê‚Ü‚¹‚ñBŠÇ—ŽÒ‚ɘA—‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(5) = "“Y•tƒtƒ@ƒCƒ‹—pƒfƒBƒŒƒNƒgƒŠ‚ªŽw’肳‚ê‚Ä‚¢‚Ü‚¹‚ñBŠˆ“®‚Ö‚Ì“Y•tƒtƒ@ƒCƒ‹‚͍쐂³‚ê‚Ü‚¹‚ñB"
    g_OutlookMsg(6) = "Šˆ“®ƒŒƒR[ƒh‚̍XV‚ª³í‚ɍs‚í‚ê‚Ü‚¹‚ñ‚Å‚µ‚½BŠÇ—ŽÒ‚ɘA—‚µ‚āASiebel  Server ƒƒOƒtƒ@ƒCƒ‹î•ñ‚ðŠm”F‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(7) = "Šˆ“®ƒŒƒR[ƒh‚ðXV‚µ‚悤‚Æ‚µ‚Ä‚¢‚鎞‚É–â‘肪Œ©‚‚©‚è‚Ü‚µ‚½BŽŸ‚̃Gƒ‰[ƒƒbƒZ[ƒW‚ðƒƒ‚‚µ‚āAŠÇ—ŽÒ‚ɘA—‚µ‚Ä‚‚¾‚³‚¢B"
    g_OutlookMsg(8) = "ƒvƒƒpƒeƒBƒIƒuƒWƒFƒNƒg‚̍쐒†‚ɃGƒ‰[‚ª”‚µ‚Ü‚µ‚½BŠÇ—ŽÒ‚ɘA—‚µ‚Ä‚‚¾‚³‚¢B"
    g_Outlookmsg(9) = "ƒAƒNƒeƒBƒrƒeƒBƒŒƒR[ƒh‚̍XVŽž‚ɃGƒ‰[‚ª”‚µ‚Ü‚µ‚½B“dŽqƒ[ƒ‹‚Ì‘—M‚𑱍s‚µ‚Ü‚•‚© ?"
       g_Outlookmsg(10) = "ƒAƒNƒeƒBƒrƒeƒBƒŒƒR[ƒh‚̍XV‚𑱍s‚µ‚Ü‚•‚© ?"
        g_Outlookmsg(11) = "‘I‘ð‚³‚ê‚½’S“–ŽÒ‚É•¡”‚ÌŒó•â‚ªˆê’v‚µ‚Ü‚•BÅ‰‚Ì’S“–ŽÒƒŒƒR[ƒh‚ɑ΂µ‚ăAƒNƒeƒBƒrƒeƒB‚ªXV‚³‚ê‚Ü‚•B’S“–ŽÒ :"
        g_Outlookmsg(12) = "ƒ[ƒ‹‚𑗐M‚µ‚½‚Ç‚Ì’S“–ŽÒ‚É‚àˆê’v‚µ‚Ü‚¹‚ñB‚Ç‚Ì’S“–ŽÒƒŒƒR[ƒh‚̃AƒNƒeƒBƒrƒeƒB‚àXV‚³‚ê‚Ü‚¹‚ñB“ü—Í‚³‚ꂽ“dŽqƒ[ƒ‹ƒAƒhƒŒƒX :"

   case "KOR"
    g_OutlookMsg(0) = "µ¥ÀÌÅͺ£À̽º ¿°á ¹®ÀÚ¿À» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.  È°µ¿  •¹ÄÚµåÀÇ °»½ÅÀÌ ¿Ï•áµÇÁö ¾Ê½À´Ï´Ù.  °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽʽÿÀ."
    g_OutlookMsg(1) = "[È°µ¿ ÀÛ¼º ÇÕ¡±× È°¼ºÈ]°¡ ¼³Á¤µÇÁö ¾Ê¾Ò½À´Ï´Ù.  È°µ¿  •¹ÄÚµåÀÇ °»½ÅÀÌ ¿Ï•áµÇÁö ¾Ê½À´Ï´Ù.  °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽʽÿÀ."
    g_OutlookMsg(2) = "Siebel HTML ¿ÀºêÁ§Æ®¸¦ ÀÛ¼ºÇÒ ¼ö ¾ø½À´Ï´Ù.  °ü¸®ÀÚ¿¡°Ô  ¹®ÀÇÇÏ¿© Siebel Web Automation Object¸¦ »ç¿ëÇÒ ¼ö ÀÖ´ÂÁö È®ÀÎÇϽʽÿÀ."
    g_OutlookMsg(3) = "Siebel HTML ¿ÀºêÁ§Æ®°¡ ÁغñµÇÁö ¾Ê¾Ò½À´Ï´Ù. À¥  ¾ÖÇø®ÄÉÀ̼ÇÀ» ´Ù½Ã ½ÃÀÛÇϽʽÿÀ.  ¹®Á¦°¡ Áö¼ÓµÇ¸é °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽʽÿÀ."
    g_OutlookMsg(4) = "Siebel¿¡¼ È°µ¿ ID°¡ Á¦°øµÇÁö ¾Ê½À´Ï´Ù.  È°µ¿ •¹ÄÚµåÀÇ  °»½ÅÀÌ ¿Ï•áµÇÁö ¾Ê½À´Ï´Ù.  ½Ã½ºÅÛ °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽʽÿÀ."
    g_OutlookMsg(5) = "պΠµð•ºÅ丮°¡ Á¦°øµÇÁö ¾Ê¾Ò½À´Ï´Ù.  È°µ¿¿¡ ´ëÇÑ Ã•ºÎ°¡  ÀÛ¼ºµÇÁö ¾Ê½À´Ï´Ù."
    g_OutlookMsg(6) = "È°µ¿ •¹Äڵ尡 ¼º°øÀûÀ¸•Î °»½ÅµÇÁö ¾Ê¾Ò½À´Ï´Ù.  °ü¸®ÀÚ¿¡°Ô  ¹®ÀÇÇÏ¿© Siebel Server •Î±× ÆÄÀÏ Á¤º¸¸¦ È®ÀÎÇϽʽÿÀ."
    g_OutlookMsg(7) = "È°µ¿ •¹Äڵ带 °»½ÅÇÏ´Â µ¿¾È ¹®Á¦°¡ ¹ß»ýÇß½À´Ï´Ù.  ´ÙÀ½  ¿À•ù ¸Þ½ÃÁö¸¦ º¹»çÇÏ¿© °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽʽÿÀ."
    g_OutlookMsg(8) = "¼Ó¼º ¿ÀºêÁ§Æ®¸¦ ÀÛ¼ºÇÏ´Â µ¿¾È ¿À•ù°¡ ¹ß»ýÇß½À´Ï´Ù.  °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇϽʽÿÀ."
    g_Outlookmsg(9) = "È°µ¿ •¹Äڵ带 ¾÷µ¥ÀÌÆ®ÇÒ § ¿À•ù°¡ ¹ß»ýÇß½À´Ï´Ù. °è¼ÓÇؼ ÀüÀÚ ¿ìÆíÀ» º¸³»½Ã°Ú½À´Ï±î?"
       g_Outlookmsg(10) = "°è¼ÓÇؼ È°µ¿ •¹Äڵ带 ¾÷µ¥ÀÌÆ®ÇϽðڽÀ´Ï±î?"
        g_Outlookmsg(11) = "¼±ÅÃÇÑ ÄÁÅÃÆ®¿¡ ÀÏÄ¡ÇÏ´Â Ç׸ñÀÌ ¿©•¯ °³ ÀÖ½À´Ï´Ù. ù ¹ø° ÄÁÅÃÆ® •¹Äڵ忡 ´ëÇÑ È°µ¿ÀÌ ¾÷µ¥ÀÌÆ®µË´Ï´Ù. ÄÁÅÃÆ®´Â ´ÙÀ½°ú °°½À´Ï´Ù."
        g_Outlookmsg(12) = "ÀüÀÚ ¿ìÆíÀ» º¸³½ ÄÁÅÃÆ®¿Í ÀÏÄ¡ÇÏ´Â °ÍÀÌ ¾ø½À´Ï´Ù. ÄÁÅÃÆ® •¹Äڵ忡 ´ëÇÑ È°µ¿ÀÌ ¾÷µ¥ÀÌÆ®µÉ ¼ö ¾ø½À´Ï´Ù. ±ÍÇÏ°¡ ÀÔ•ÂÇÑ ÀüÀÚ ¿ìÆí ÁÖ¼Ò´Â ´ÙÀ½°ú °°½À´Ï´Ù."

   case "ITA"
    g_Outlookmsg(0) = "Stringa di connessione al database non  disponibile. Il record attività non verrà aggiornato. Contattare l'amministratore"
    g_Outlookmsg(1) = "Flag di abilitazione creazione attività non  impostato. Il record attività non verrà aggiornato. Contattare l'amministratore."
    g_Outlookmsg(2) = "Impossibile creare l'oggetto HTML Siebel.  Contattare l'amministratore per controllare che Siebel Web Automation Object sia abilitato."
    g_Outlookmsg(3) = "Oggetto HTML Siebel non pronto. Riavviare  l'applicazione Web. Se il problema persiste, contattare l'amministratore."
    g_Outlookmsg(4) = "ID attività non fornito da Siebel. Il record  attività non verrà aggiornato. Contattare l'amministratore."
    g_Outlookmsg(5) = "Directory degli allegati non specificata. Gli  allegati non verranno creati per l'attività."
    g_Outlookmsg(6) = "Il record attività non è stato aggiornato  correttamente. Contattare l'amministratore per controllare le informazioni del file log del  server Siebel."
    g_Outlookmsg(7) = "Si è verificato un problema durante  l'aggiornamento del record attività. Per assistenza, prendere nota del seguente messaggio di  errore e contattare l'amministratore."
    g_Outlookmsg(8) = "Errore di creazione dell'oggetto di proprietà.  Contattare l'amministratore."
    g_Outlookmsg(9) = "Errore durante l'aggiornamento del record attività. Continuare a inviare l'e-mail?"
       g_Outlookmsg(10) = "Continuare ad aggiornare il record attività?"
        g_Outlookmsg(11) = "Sono presenti più corrispondenze per il contatto o i contatti selezionati. L'attività verrà aggiornata per il primo contatto disponibile. Il contatto o i contatti sono:"
        g_Outlookmsg(12) = "Non sono presenti corrispondenze per i contatti a cui sono stati inviati messaggi di posta. L'attività non può essere aggiornata per nessuno dei record del contatto. Indirizzo o indirizzi immessi:"

   case "PTG"
    g_OutlookMsg(0) = "A cadeia de ligação da base de dados não está  disponível. Não será efectuada a actualização do registo de actividades. Contacte o  administrador."
    g_OutlookMsg(1) = "O sinalizador Activar criação de actividades não  está definido. A actualização do registo de actividades não será efectuada. Contacte o  administrador."
    g_OutlookMsg(2) = "Não é possível criar o objecto HTML do Siebel.   Contacte o administrador para se certificar de que o Siebel Web Automation Object está  activado."
    g_OutlookMsg(3) = "O objecto HTML do Siebel não está pronto.  Reinicie a aplicação na Internet. Se o problema persistir, consulte o administrador."
    g_OutlookMsg(4) = "O ID da actividade não é fornecido a partir do  Siebel. O registo de actividades não será actualizado. Contacte o administrador."
    g_OutlookMsg(5) = "O directório de anexos não foi fornecido. Não  serão criados anexos para a actividade."
    g_OutlookMsg(6) = "O registo de actividades não foi actualizado com  êxito. Contacte o administrador para verificar as informações do ficheiro de registo do  Siebel Server."
    g_OutlookMsg(7) = "Foi encontrado um problema na tentativa de  actualização do registo de actividades.  Copie a seguinte mensagem de erro e consulte o  administrador para obter ajuda."
    g_OutlookMsg(8) = "Erro na criação do Objecto de propriedade.  Contacte o administrador."
    g_Outlookmsg(9) = "Ocorreu um erro ao actualizar o registo da actividade. Pretende continuar o envio do email?"
       g_Outlookmsg(10) = "Pretende continuar a actualização do registo da actividade?"
        g_Outlookmsg(11) = "Existem várias correspondências para o(s) contacto(s) seleccionado(s). A actividade será actualizada para o primeiro registo de contacto disponível. O(s) contacto(s) é(são):"
        g_Outlookmsg(12) = "Não existe correspondência para nenhum contacto para o qual enviou correio. Não é possível actualizar a actividade para nenhum registo de contacto. O(s) endereço(s) de email introduzido(s) foram:"

   case "PTB"
    g_Outlookmsg(0) = "A string de conexão do banco de dados não está  disponível. A atualização do registro de atividade não será feita. Entre em contato com o  administrador."
    g_Outlookmsg(1) = "O Indicador ativar Criação de atividade não está  definido. A atualização do registro de atividade não será feita. Entre em contato com o  administrador."
    g_Outlookmsg(2) = "Não é possível criar o objeto HTML do Siebel.  Entre em contato com o administrador para verificar se o objeto de automação da Web do  Siebel está ativado."
    g_Outlookmsg(3) = "O objeto HTML do Siebel não está pronto. Reinicie  seu aplicativo da Web. Se o problema persistir, consulte o administrador."
    g_Outlookmsg(4) = "O Código de atividade não foi fornecido pela  Siebel. A atualização do registro de atividade não será feita. Entre em contato com o  administrador."
    g_Outlookmsg(5) = "O diretório de anexos não foi fornecido. Não  serão criados anexos para a atividade."
    g_Outlookmsg(6) = "O registro de atividade não foi atualizado com  êxito. Entre em contato com o administrador para verificar as informações do arquivo de log  do servidor Siebel."
    g_Outlookmsg(7) = "Houve um problema durante a tentativa de  atualizar o registro de atividade. Copie a mensagem de erro a seguir e consulte o seu  administrador para obter ajuda."
    g_Outlookmsg(8) = "Erro ao criar objeto de propriedade. Entre em  contato com o administrador."
    g_Outlookmsg(9) = "Ocorreu um erro ao atualizar o registro da atividade. Deseja continuar a enviar o e-mail?"
       g_Outlookmsg(10) = "Deseja continuar a atualizar o registro da atividade?"
        g_Outlookmsg(11) = "Existem várias correspondências para os contados selecionados. A atividade será atualizada para o primeiro registro de contato disponível. Os contatos são:"
        g_Outlookmsg(12) = "Não há nenhuma correspondência para os contatos para os quais você enviou a correspondência. A atividade não pode ser atualizada para o registro do contato. Você digitou os endereços de e-mail:"

   case "NLD"
    g_OutlookMsg(0) = "Databaseverbindingsstring is niet beschikbaar.   Bijwerken van de activiteitenrecord wordt niet uitgevoerd.  Neem contact op met de  beheerder"
    g_OutlookMsg(1) = "Markering Activiteit aanmaken inschakelen is niet  ingeschakeld.  Bijwerken van de activiteitenrecord wordt niet uitgevoerd.  Neem contact op  met de beheerder."
    g_OutlookMsg(2) = "Kan Siebel HTML-object niet aanmaken.  Neem  contact op met de beheerder om te controleren of het Siebel Web Automation-object is  ingeschakeld."
    g_OutlookMsg(3) = "Siebel HTML-object niet gereed. Start de  webtoepassing opnieuw.  Neem indien het probleem zich blijft voordoen contact op met de  beheerder."
    g_OutlookMsg(4) = "Activiteiten-ID niet verstrekt door Siebel.   Bijwerken van de activiteitenrecord wordt niet uitgevoerd.  Neem contact op met de  beheerder."
    g_OutlookMsg(5) = "Bijlagedirectory is niet opgegeven.  Er worden  geen bijlagen gemaakt voor de activiteit."
    g_OutlookMsg(6) = "De activiteitenrecord is niet met succes  bijgewerkt.  Neem contact op met de beheerder om de informatie uit het logboekbestand op de  Siebel-server te controleren."
    g_OutlookMsg(7) = "Er is een probleem opgetreden tijdens een poging  tot het bijwerken van de activiteitenrecord.  Noteer het volgende foutbericht en neem  contact op met de beheerder voor assistentie."
    g_OutlookMsg(8) = "Fout tijdens het aanmaken van een  eigenschapobject. Neem contact op met de beheerder."
    g_Outlookmsg(9) = "Fout tijdens bijwerking van activiteitenrecord. Wilt u doorgaan met verzenden van de e-mail?"
       g_Outlookmsg(10) = "Wilt u doorgaan met bijwerken van het activiteitenrecord?"
        g_Outlookmsg(11) = "Er zijn meerdere treffers voor de relaties die u hebt geselecteerd. De activiteit wordt bijgewerkt voor de eerste beschikbare relatierecord. De relatie(s) is/zijn:"
        g_Outlookmsg(12) = "Geen treffer onder de relaties naar wie u mailberichten hebt gestuurd. De activiteit kan voor geen enkel relatierecord worden bijgewerkt. U hebt het/de volgende mailadres(sen) opgegeven:"

   case "SVE"
    g_Outlookmsg(0) = "Anslutningssträngen för databasen är inte  tillgänglig.  Uppdateringar av den här aktivitetsposten görs inte.  Kontakta  administratören."
    g_Outlookmsg(1) = "Flaggan för aktivering av aktivitetsgenerering  har inte ställts in.  Uppdateringar av den här aktivitetsposten görs inte.  Kontakta  administratören."
    g_Outlookmsg(2) = "Det gick inte att skapa Siebel HTML-objektet.   Kontakta administratören och kontrollera att Siebel Web Automation Object har aktiverats."
    g_Outlookmsg(3) = "Siebel HTML-objektet är inte klart. Starta om  webbprogrammet. Om problemet kvarstår kontaktar du administratören."
    g_Outlookmsg(4) = "Aktivitets-id:t tillhandahålls inte från Siebel.   Uppdateringar av den här aktivitetsposten görs inte.  Kontakta administratören."
    g_Outlookmsg(5) = "Bilagekatalogen tillhandahålls inte.  Bilagor  skapas inte för aktiviteten."
    g_Outlookmsg(6) = "Aktivitetsposten har inte uppdaterats. Kontakta administratören och kontrollera loggfilsinformationen för Siebel-servern."
    g_Outlookmsg(7) = "Ett problem upptäcktes när du försökte att uppdatera aktivitetsposten. Kopiera följande felmeddelande och kontakta administratören."
    g_Outlookmsg(8) = "Fel när egenskapsobjektet skapas. Kontakta administratören."
    g_Outlookmsg(9) = "Fel vid uppdatering av aktivitetspost. Vill du fortsätta med att skicka e-post?"
       g_Outlookmsg(10) = "Vill du fortsätta med att uppdatera aktivitetsposten?"
        g_Outlookmsg(11) = "Det finns flera kontakter som matchar kontakten som du har valt. Aktiviteten uppdateras för den första tillgängliga kontaktposten. Kontakterna är följande:"
        g_Outlookmsg(12) = "Det finns ingen kontakt som matchar dem som du har skickat post till. Aktiviteten kan inte uppdateras för någon kontakpost. Du angav följande e-postadresser:"

   case else
        g_Outlookmsg(0) = "Database connect string is not presented. Update will not be done."
         g_Outlookmsg(1) = "EnableActivityCreate Flag is not set. Update will not be done."  
         g_Outlookmsg(2) = "SiebelHTML object cannot be created. Please check whether the Siebel Web Automation Object is enabled."  
         g_Outlookmsg(3) = "SiebelHTML object is not ready. Please restart your web  application. If problem persists, please consult your administrator."
         g_Outlookmsg(4) = "ActivityID is not provided from Siebel. Update will not be  done."
         g_Outlookmsg(5) = "Attachment directory is not provided. Attachments will not be  created for activity"
         g_Outlookmsg(6) = "Update was not done successfully. Please check Siebel Server for errors."
         g_Outlookmsg(7) = "There is problem in carrying an activity update operation. Please copy the following error and ask your administrator for help."
         g_Outlookmsg(8) = "Error in creating Property Object."
        g_Outlookmsg(9) = "Error occurred in updating the activity record. Do you want to continue to send the email?"
        g_Outlookmsg(10) = "Do you want to continue to update the activity record?"
    g_Outlookmsg(11) = "There are multiple matches for the contact you selected. The activity shall be updated on the first available record. The name of the contact is "
    g_Outlookmsg(12) = "There is no match for the contact you sent mail. The activity cannot be updated on any record. The Email Address you typed is "

   End Select

   Set propActId = Item.UserProperties("ActivityID")
   If Not propActId Is Nothing Then
      g_strActivityId = propActId.Value
      propActId.Value = g_strDraftItem
   End If

   Set propConnectString = Item.UserProperties("ConnectString")
   If Not propConnectString Is Nothing Then
      g_strConnectString = propConnectString.Value
   End If

   Set propDebug = Item.UserProperties("Debug")
   If Not propDebug Is Nothing Then
      If propDebug.Value = "TRUE" Then
         g_bDebug = True
      End If
   End If

   If g_bDebug Then
      Set g_debugNote = Application.CreateItem (6) ' olPostItem
      If g_strActivityId <> "" Then
         g_debugNote.Subject = "SiebelDebugLog_" + g_strActivityId
      Else
         g_debugNote.Subject = "SiebelDebugLog"
      End If
   End If

   On Error Resume Next

   Set oUserPreferredFormat = Item.UserProperties ("SiebelEmailFormat")
   If oUserPreferredFormat.Value = "HTML/Plain Text" Then
    item.BodyFormat = 2
   else
    item.BodyFormat = 1
   End If

   ' This is used to test display all messages
   ' DisplayAllMsgs

End Function

'*******************************************************************************************
' Handler for Send event
' Purpose: Update the database record if necessary and send the email
' Inputs: None
' Outputs: False
'*******************************************************************************************
Function Item_Send ()
   On Error Resume Next
   Err = 0
   g_errMsg = ""
   g_bSent = True

   LogDebug "Enter Item_Send()"
'
' Update the activity
'
   LogDebug "Updating activity"
   UpdateActivity Item
   bContinue = True
   If g_errMsg <> "" Then
      prompt = g_Outlookmsg(7) + Chr(13) + Chr(13) + g_errMsg
      g_errMsg = ""

      LogDebug prompt

      status = MsgBox (prompt, 1)
      If status <> 1 Then
         bContinue = False
         g_bSent = False
         LogDebug "User chose not to send the email, activity will be deleted if any"
      Else
         LogDebug "User chose to send the email anyway"
      End If
   End If

   If bContinue Then
      If Not g_bCopyAndSend Then
         Item.MessageClass = "IPM.NOTE"
         LogDebug "Set MessageClass to IPM.NOTE"
         Item_Send = True
      Else
         Err = 0
         LogDebug "Copy and send the email"
         SendMailWithRegularForm Item

         If Err <> 0 Then
            MsgBox Err.Description
            LogDebug Err.Description
            Err.Clear
         End If
         ' Discard the original item
         Item.Close 1
         Item_Send = False
      End If
   Else
      ' Discard the original item
      Item.Close 1
      Item_Send = False
   End If

   If g_bDebug Then
      LogDebug "Leave Item_Send()"
   End If
End Function

'*******************************************************************************************
' Handler for Close event
' Purpose: Delete the database record if the email is not sent.
' Inputs: None
' Outputs: True
'*******************************************************************************************
Function Item_Close()
   On Error Resume Next

   LogDebug "Enter Item_Close() "

   g_errMsg = ""

   If g_strActivityId <> g_strDraftItem Then
      If Not g_bSent Then
         LogDebug "User clicked Close to cancel the item"

         If g_strActivityId <> "" Then
            '
            ' The next If statement is meant to avoid sending out wrong cancel event when
            ' receiver opens the sent item. SenderName should be valid if the item already
            ' send out.
            '
            ' If in Item_Send(), we set the MessageClass to "IPM.NOTE", this If statement
            ' if not necessary. This item will be opened with "IPM.NOTE" unless user changes
            ' it.
            '
            'If Item.Parent = "Inbox" And Item.SenderName = "" Then
               Set propCreateActivity =  Item.UserProperties("EnableActivityCreation")
               If Not propCreateActivity Is Nothing Then
                  If propCreateActivity.Value = "TRUE" Then
                     LogDebug "Deleting the activity"
                     bOK = DeleteActivity (g_strActivityId)

                     If g_errMsg = "" Then
                        LogDebug "Activity deleted"
                     End If
                  Else
                     LogDebug "EnableActivityCreation is not set to TRUE. Deletion not  necessary"
                  End If
               Else
                  LogDebug "Property EnableActivityCreation not found"
               End If
            'Else
            '   LogDebug "Item not in Inbox"
            'End If
         Else
            LogDebug "Property ActivityID not found"
         End If
      Else
         LogDebug "Close item after it is sent"
      End If
   Else
      LogDebug "This is a draft of a previous item, no updating is done"
   End If

   If g_errMsg <> "" Then
      MsgBox g_errMsg
      LogDebug g_errMsg
   End If

   If g_bDebug Then
      LogDebug "Leave Item_Close()"
      g_debugNote.Save
   End If

   ' Disable SavePrompt
   'Item.Close 1
End Function

Function GetDistributionList(oSession, oMemberEntry)
    Dim oRecipient
    Dim emailAddress
    Dim oAddrEntry
    Dim emailGroup
      Dim errormsg
    emailGroup = ""
      LogDebug "Call GetDistributionList"
    For Each oAddrEntry In oMemberEntry
       emailAddress = oAddrEntry.Address
       If (emailAddress <> "") And (Left(emailAddress, 3) = "/o=") Then
          ' Address id
          addrEntryId = oAddrEntry.ID
          If addrEntryId <> "" Then
             emailAddress =  oSession.GetAddressEntry(addrEntryId).Fields(CdoPR_EMAIL).Value
             If emailAddress = "" Then
                emailAddress = oAddrAddress.Name
             End If
          Else
             emailAddress = oAddrEntry.Name
          End If
          If Left(emailAddress, 3) = "/o=" Then
             emailAddress = oAddrEntry.Name
          End If
       End If
       if (emailGroup = "") And (emailAddress <> "") Then
          emailGroup = emailAddress
       else
          emailGroup = emailGroup + ";" + emailAddress
       End If
    Next      
      errormsg = "Returning addresses: " + emailGroup
      LogDebug errormsg
      GetDistributionList = emailGroup
End Function

Function GetGlobalDistributionList(oSession, oGDistributionList)
   'Get Global Address List.
   Dim oDLs
   Dim oGal
   Dim sDL
   Dim oEntries
   Dim oRecipient
   Dim emailAddress
   Dim oAddrEntry
   Dim emailGroup
   dim errormsg
   Dim emailAddresses
   Dim fullAddress
   Dim fullName

   emailGroup = ""
   Set oDLs = oSession.AddressLists
   Set oGal = oDLs.Item("Global Address List")
   Set oEntries = oGal.AddressEntries
   Set oDL = oEntries.Item(oGDistributionList)
   LogDebug "Call GlobalDistributionList"
   errormsg = "Target Distributionlist Name is " + oGDistributionList
   LogDebug errormsg
   Set emailAddresses = Nothing
   Set emailAddresses = oDL.Members
   if Not (emailAddresses is Nothing) Then
      ' There are members in the address book
       For Each oAddrEntry In emailAddresses
           emailAddress = oAddrEntry.Address
           If (emailAddress <> "") And (Left(emailAddress, 3) = "/o=") Then
              ' Address id
              addrEntryId = oAddrEntry.ID
              If addrEntryId <> "" Then
                 emailAddress =  oSession.GetAddressEntry(addrEntryId).Fields(CdoPR_EMAIL).Value
                 If emailAddress = "" Then
                    emailAddress = oAddrAddress.Name
                 End If
              Else
                 emailAddress = oAddrEntry.Name
              End If
              If Left(emailAddress, 3) = "/o=" Then
                 emailAddress = oAddrEntry.Name
              End If
           End If
           if (emailGroup = "") And (emailAddress <> "") Then
              emailGroup = emailAddress
           else
              emailGroup = emailGroup + ";" + emailAddress
           End If
        Next      
        errormsg = "Returning addresses: " + emailGroup
            LogDebug errormsg
    else
       ' There is no members in the list
       LogDebug "There is no members in this Group.  This is probably not a Group"
       emailGroup = ""
    End If
    GetGlobalDistributionList = emailGroup
End Function

'
' This function is used to test all the message
'
Function DisplayAllMsgs()
    MsgBox g_Outlookmsg(0)
    MsgBox g_Outlookmsg(1)
    MsgBox g_Outlookmsg(2)
    MsgBox g_Outlookmsg(3)
    MsgBox g_Outlookmsg(4)
    MsgBox g_Outlookmsg(5)
    MsgBox g_Outlookmsg(6)
    MsgBox g_Outlookmsg(7)
    MsgBox g_Outlookmsg(8)
    MsgBox g_Outlookmsg(9)
    MsgBox g_Outlookmsg(10)
    MsgBox g_Outlookmsg(11)
    MsgBox g_Outlookmsg(12)

End Function

Function ResolveMultiMatches(oApp, oInProp, strFullAddressList, strContactList, oOutTempProp)

LogDebug "Get business service: Inbound E-mail Database Operations"
    Dim ArrTmp3,sArray,y,tmpstr1,strMatchList,strList,sTempList
    strList=""
    Err = 0
    y =0
    If strFullAddressList <> "" Then
    tmpstr1 = strFullAddressList
    Else
    If strContactList <> "" Then
    tmpstr1 = strContactList
    End If
    End If
    If tmpstr1 <> "" Then
    Arrtmp3 = Split(tmpstr1,";",-1,1)
    count = ubound(ArrTmp3)
    Set oBS = oApp.GetService ("Inbound E-mail Database Operations")
    Set oOutTempProp = oApp.NewPropertySet
    If (Not oBS Is Nothing) And (Err = 0) Then
        LogDebug "Call method ResolveMultiMatch"
        For y =0 to count
            bOK = SetPropertyValue (oInProp, "ContactList", Arrtmp3(y))
            bOK = oBS.InvokeMethod ("ResolveMultiMatch", oInProp, oOutTempProp)
            strMultipleMatch = oOutTempProp.GetProperty ("Multiple Match Contact")
            LogDebug "MultiMatch List:"+strMultipleMatch
            If strMultipleMatch <> "" Then
            If (g_bDisplayMatches) Then
            DisplayMatches strMultipleMatch, Arrtmp3, strList
            Else
            sArray = Split(strMultipleMatch,",",-1,1)
            strList = sArray(0)&","
            End If
            End If
            strMatchList = oOutTempProp.GetProperty ("Match Contact List")
            If strMatchList <> "" Then
            strMatchList = strMatchList&","
            sTempList=sTempList&strMatchList
            End If
            If strList <> "" Then
            sTempList=sTempList&strList
            End If
        Next

        bOK = SetPropertyValue (oInProp, "Resolved Match List", sTempList)
    End If
    End If
    If strFullAddressList <> "" Then
    bOK = SetPropertyValue (oInProp, "ContactList", strFullAddressList)
    Else
    If strContactList <> "" Then
        bOK = SetPropertyValue (oInProp, "ContactList", strContactList)
    End If
    End If
End Function

Function DisplayMatches(strMultipleMatch, ArrTmp3, strList)
    Dim Pos
    Dim ArrTmp,ArrTmp1,ArrTmp2,ArrTmp4
    Dim i,j,k,x,z,rows,rows2
    Dim tempstr
    Dim strMatchList,strVal,strLocal,strTitle,listno,temp,temp1,temp2
    Dim a,b,c,d   ' Create a variable.
    If strMultipleMatch <> "" Then
                          ArrTmp = Split(strMultipleMatch,",",-1,1)
                        rows = (ubound(ArrTmp) - 1) ' ncols = 4
                        strLocal=""
                         x=""
                         z=1
                        For j=0 to rows
                          Arrtmp1 = Arrtmp(j)
                          Arrtmp(j) = ";"&z
                          j=j+4
                          z=z+1
                          x=x&ArrTmp1&","
                          Next
                        For c=0 to rows
                        temp1 = Arrtmp(c)
                        strLocal = strLocal&temp1&","
                        Next
                        x=Replace(x,";","" )
                         Arrtmp2 = Split(x,",",-1,1)                
                        rows2 = (ubound(ArrTmp2) - 1)
                        z=1
                        temp=1
                        Set d = CreateObject("Scripting.Dictionary")
                        For b=0 to rows2
                        temp2 = ""&z&""
                        d.Add temp2,Arrtmp2(b)
                        listno = listno&temp&","
                        temp=temp+1
                        z = z+1
                        Next   ' Add some keys and items.
                        Arrtmp4 = Split(listno,",",-1,1)
                          strMultipleMatch=Replace(strLocal,",","     ")   
                          strMultipleMatch=Replace(strMultipleMatch,";",(Chr(13) & Chr(10)) )
                              strTitle="Matching List for Contact:"&Arrtmp3(count)
                        strMsg=inputbox(strMultipleMatch,strTitle,"Select a number from above to choose the intended contact",900,900)
                        Do Until strMsg <> ""
                        msgbox ("Please enter one of the Contact numbers in the Contact List!")
                        strMsg=inputbox(strMultipleMatch,strTitle,"Select a number from above to choose the intended contact ",900,900)
                        loop
                          Pos =1
                          Do Until Pos = 0
                                  For k =0 to rows2
                                  Pos = StrComp(ArrTmp4(k), strMsg, 1) ' Returns 0.
                                  If Pos = 0 Then
                                  Exit For
                                  End If
                                 Next
                            If Pos <> 0 Then
                             msgbox ("Please enter one of the Contact numbers in the Contact List!")
                            strMsg=inputbox(strMultipleMatch,strTitle,"Select a number from above to choose the intended contact",900,900)
                            End If       
                        loop
                        If d.Exists(strMsg) Then
                           strVal = d.Item(strMsg)
                        End If
                          strList=strList&strVal&","
                       End If
End Function

你可能感兴趣的:(html,function,properties,database,VBScript,email)