Integration of LimiLabs, Init
This commit is contained in:
@@ -9,6 +9,8 @@ Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Controls.LookupGrid
|
||||
Imports DigitalData.GUIs.GlobalIndexer
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports Limilabs.Mail
|
||||
Imports Limilabs.Mail.Headers
|
||||
|
||||
Public Class frmIndex
|
||||
#Region "+++++ Variablen ++++++"
|
||||
@@ -835,13 +837,13 @@ Public Class frmIndex
|
||||
Next
|
||||
End If
|
||||
If DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or CURRENT_NEWFILENAME.EndsWith(".msg") Then
|
||||
indexierung_erfolgreich = SetEmailIndices()
|
||||
indexierung_erfolgreich = SetEmailIndicies(pIndexAttachment:=False)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
ElseIf DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then
|
||||
indexierung_erfolgreich = SetAttachmentIndices()
|
||||
indexierung_erfolgreich = SetEmailIndicies(pIndexAttachment:=True)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
@@ -866,9 +868,79 @@ Public Class frmIndex
|
||||
|
||||
End Function
|
||||
|
||||
Private Function SetEmailIndices()
|
||||
Private Function SetEmailIndicies(pIndexAttachment As Boolean) As Boolean
|
||||
Try
|
||||
Dim oMsgFilePath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
|
||||
Dim oEmlFilePath As String = EMAIL.Convert_MsgToEml(oMsgFilePath)
|
||||
Dim oMail As IMail = EMAIL.Load_Email(oEmlFilePath)
|
||||
|
||||
Dim oSQL As String = $"SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '{CURR_DOKART_OBJECTTYPE}'"
|
||||
Dim oTable As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
||||
|
||||
If IsNothing(oTable) Then
|
||||
_Logger.Info("Could not get Email Indicies for DocType = [{0}]. Exiting.", CURR_DOKART_OBJECTTYPE)
|
||||
Return False
|
||||
End If
|
||||
|
||||
If oTable.Rows.Count = 0 Then
|
||||
LOGGER.Warn("Could not get Email Indicies for DocType = [{0}]. Exiting.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
If oTable.Rows.Count > 1 Then
|
||||
LOGGER.Warn("Got multiple rows for Email Indicies for DocType = [{0}]. Exiting.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oMessageId As String = oMail.MessageID
|
||||
Dim oMessageFrom As String = oMail.From.First?.Address
|
||||
Dim oMessageTo As String = DirectCast(oMail.To.First, MailBox)?.Address
|
||||
Dim oSubject As String = oMail.Subject
|
||||
Dim oDateIn As Date = oMail.Date
|
||||
|
||||
Dim oRow As DataRow = oTable.Rows.Item(0)
|
||||
Dim oIndexNames As New Dictionary(Of String, Object) From {
|
||||
{"IDX_EMAIL_ID", oMessageId},
|
||||
{"IDX_EMAIL_FROM", oMessageFrom},
|
||||
{"IDX_EMAIL_TO", oMessageTo},
|
||||
{"IDX_EMAIL_SUBJECT", oSubject},
|
||||
{"IDX_EMAIL_DATE_IN", oDateIn}
|
||||
}
|
||||
|
||||
If pIndexAttachment = True Then
|
||||
oIndexNames.Add("IDX_CHECK_ATTACHMENT", True)
|
||||
End If
|
||||
|
||||
For Each oIndex In oIndexNames
|
||||
Try
|
||||
If oIndex.Value Is Nothing OrElse oIndex.Value = String.Empty Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oIndexingSuccessful = WriteIndex2File(oRow.Item(oIndex.Key), oIndex.Value)
|
||||
'Die aktuelle Message-ID zwischenspeichern
|
||||
CURRENT_MESSAGEID = oMessageId
|
||||
If oIndexingSuccessful = False Then
|
||||
MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function SetEmailIndicesOld()
|
||||
Dim indexierung_erfolgreich As Boolean = False
|
||||
Dim _step As String = "1"
|
||||
|
||||
Try
|
||||
Dim oTempPath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
|
||||
Dim msg As Msg.Message = New Msg.Message(oTempPath)
|
||||
@@ -995,7 +1067,6 @@ Public Class frmIndex
|
||||
_step = "5"
|
||||
_Logger.Info("emailTo and From Extraction via messageheader.")
|
||||
emailFrom = ClassEmailHeaderExtractor.extractFromHeader(headers, fromPattern) 'FromRegexList)
|
||||
|
||||
emailTo = ClassEmailHeaderExtractor.extractFromHeader(headers, toPattern) ' extractToAddress(headers, ToRegexList)
|
||||
|
||||
'Handler für leere emailTo-Adresse
|
||||
@@ -1037,6 +1108,7 @@ Public Class frmIndex
|
||||
emailTo = ClassEmailHeaderExtractor.extractFromHeader(emailTo, finalize_pattern)
|
||||
emailFrom = ClassEmailHeaderExtractor.extractFromHeader(emailFrom, finalize_pattern)
|
||||
_step = "6.1"
|
||||
|
||||
If Not IsNothing(emailFrom) Then
|
||||
emailFrom = emailFrom.Replace("<", "")
|
||||
emailFrom = emailFrom.Replace(">", "")
|
||||
|
||||
Reference in New Issue
Block a user