Compare commits

4 Commits

Author SHA1 Message Date
Jonathan Jenne
ab2a0134f7 Version 2.4.2.8 2021-08-23 15:23:19 +02:00
Jonathan Jenne
3fa9e8b75e fix jumbled up indexnames in WriteIndex2File 2021-08-23 15:21:47 +02:00
Jonathan Jenne
cff6c289bb Version 2.4.2.7 2021-08-23 15:06:52 +02:00
Jonathan Jenne
7a60728a27 support eml in write_indizes, fix indexing of attachments 2021-08-23 15:06:33 +02:00
2 changed files with 39 additions and 25 deletions

View File

@@ -33,7 +33,7 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.4.2.6")>
<Assembly: AssemblyVersion("2.4.2.8")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: NeutralResourcesLanguageAttribute("")>

View File

@@ -835,7 +835,7 @@ Public Class frmIndex
End If
Next
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)
If indexierung_erfolgreich = False Then
MsgBox("Error in SetEmailIndices - See log", MsgBoxStyle.Critical)
@@ -856,21 +856,19 @@ Public Class frmIndex
End Try
Return True
End Function
Private Function WriteIndex2File(indexname As String, indexvalue As String)
Private Function WriteIndex2File(pIndexName As String, pIndexValue As String)
Try
_Logger.Info("Indexvalue: " & indexvalue.ToString)
Return WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, indexname, indexvalue, CURR_DOKART_OBJECTTYPE)
_Logger.Info($"Indexing with Name {pIndexName} and Value: {pIndexValue.ToString}")
Return WINDREAM.SetFileIndex(CURRENT_NEWFILENAME, pIndexName, pIndexValue, CURR_DOKART_OBJECTTYPE)
Catch ex As Exception
ShowErrorMessage(ex, "WriteIndex2File")
Return False
End Try
End Function
Private Function SetEmailIndicies(pIndexAttachment As Boolean) As Boolean
Try
Dim oMsgFilePath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
Dim oMail As IMail = EMAIL.Load_Email(oMsgFilePath)
Dim oIndexNames As Dictionary(Of String, Object)
Dim oSQL As String = $"SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '{CURR_DOKART_OBJECTTYPE}'"
Dim oTable As DataTable = ClassDatabase.Return_Datatable(oSQL)
@@ -890,25 +888,42 @@ Public Class frmIndex
Return False
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 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)
' If file is an email files (eml,msg) parse it to extract email data and save for later
' 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_MESSAGESUBJECT},
{"IDX_EMAIL_DATE_IN", CURRENT_MESSAGEDATE},
{"IDX_CHECK_ATTACHMENT", True}
}
End If
For Each oIndex In oIndexNames
Try
If oIndex.Value Is Nothing Then
@@ -923,9 +938,8 @@ Public Class frmIndex
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 while Indexing Email at Index [{oIndex.Key}]", MsgBoxStyle.Critical)