support eml in write_indizes, fix indexing of attachments
This commit is contained in:
parent
f23a5a3ec1
commit
7a60728a27
@ -835,7 +835,7 @@ Public Class frmIndex
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
If DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or CURRENT_NEWFILENAME.EndsWith(".msg") Then
|
If DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".msg") Or CURRENT_NEWFILENAME.ToUpper.EndsWith(".eml") Then
|
||||||
indexierung_erfolgreich = SetEmailIndicies(pIndexAttachment:=False)
|
indexierung_erfolgreich = SetEmailIndicies(pIndexAttachment:=False)
|
||||||
If indexierung_erfolgreich = False Then
|
If indexierung_erfolgreich = False Then
|
||||||
MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical)
|
MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical)
|
||||||
@ -865,12 +865,16 @@ Public Class frmIndex
|
|||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function SetAttachmentIndicies() As Boolean
|
||||||
|
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function SetEmailIndicies(pIndexAttachment As Boolean) As Boolean
|
Private Function SetEmailIndicies(pIndexAttachment As Boolean) As Boolean
|
||||||
Try
|
Try
|
||||||
Dim oMsgFilePath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
|
Dim oIndexNames As Dictionary(Of String, Object)
|
||||||
Dim oMail As IMail = EMAIL.Load_Email(oMsgFilePath)
|
|
||||||
|
|
||||||
Dim oSQL As String = $"SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '{CURR_DOKART_OBJECTTYPE}'"
|
Dim oSQL As String = $"SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '{CURR_DOKART_OBJECTTYPE}'"
|
||||||
Dim oTable As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
Dim oTable As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
||||||
@ -890,25 +894,42 @@ Public Class frmIndex
|
|||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oMessageId As String = oMail.MessageID
|
|
||||||
Dim oMessageFrom As String = EMAIL.Get_MessageSender(oMail)
|
|
||||||
Dim oMessageTo As String = EMAIL.Get_MessageReceiver(oMail)
|
|
||||||
Dim oSubject As String = oMail.Subject
|
|
||||||
Dim oDateIn As Date = oMail.Date
|
|
||||||
|
|
||||||
Dim oRow As DataRow = oTable.Rows.Item(0)
|
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
|
' If file is an email files (eml,msg) parse it to extract email data and save for later
|
||||||
oIndexNames.Add("IDX_CHECK_ATTACHMENT", True)
|
' If file is an attachment, rely on the previously extracted value
|
||||||
|
|
||||||
|
If pIndexAttachment = False Then
|
||||||
|
Dim oMsgFilePath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
|
||||||
|
Dim oMail As IMail = EMAIL.Load_Email(oMsgFilePath)
|
||||||
|
|
||||||
|
Dim oMessageId As String = oMail.MessageID
|
||||||
|
Dim oMessageFrom As String = EMAIL.Get_MessageSender(oMail)
|
||||||
|
Dim oMessageTo As String = EMAIL.Get_MessageReceiver(oMail)
|
||||||
|
Dim oSubject As String = oMail.Subject
|
||||||
|
Dim oDateIn As Date = oMail.Date
|
||||||
|
|
||||||
|
CURRENT_MESSAGEID = oMessageFrom
|
||||||
|
CURRENT_MESSAGEDATE = oDateIn
|
||||||
|
CURRENT_MESSAGESUBJECT = oSubject
|
||||||
|
|
||||||
|
oIndexNames = 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}
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
oIndexNames = New Dictionary(Of String, Object) From {
|
||||||
|
{"IDX_EMAIL_ID", CURRENT_MESSAGEID},
|
||||||
|
{"IDX_EMAIL_SUBJECT", CURRENT_MESSAGEDATE},
|
||||||
|
{"IDX_EMAIL_DATE_IN", CURRENT_MESSAGESUBJECT},
|
||||||
|
{"IDX_CHECK_ATTACHMENT", True}
|
||||||
|
}
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
For Each oIndex In oIndexNames
|
For Each oIndex In oIndexNames
|
||||||
Try
|
Try
|
||||||
If oIndex.Value Is Nothing Then
|
If oIndex.Value Is Nothing Then
|
||||||
@ -924,8 +945,6 @@ Public Class frmIndex
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oIndexingSuccessful = WriteIndex2File(oRow.Item(oIndex.Key), oIndex.Value)
|
Dim oIndexingSuccessful = WriteIndex2File(oRow.Item(oIndex.Key), oIndex.Value)
|
||||||
'Die aktuelle Message-ID zwischenspeichern
|
|
||||||
CURRENT_MESSAGEID = oMessageId
|
|
||||||
|
|
||||||
If oIndexingSuccessful = False Then
|
If oIndexingSuccessful = False Then
|
||||||
MsgBox($"Error while Indexing Email at Index [{oIndex.Key}]", MsgBoxStyle.Critical)
|
MsgBox($"Error while Indexing Email at Index [{oIndex.Key}]", MsgBoxStyle.Critical)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user