Version 2.4.2.2 - Remove Independentsoft Email, Replace with Limilabs.Mail, Remove manual Email Data Exctraction, Support Eml Files
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports Independentsoft
|
||||
Imports System.Text
|
||||
Imports System.Security.AccessControl
|
||||
Imports System.Security.Principal
|
||||
@@ -313,17 +312,17 @@ Public Class frmIndex
|
||||
|
||||
'#End Region
|
||||
'#Region "+++++ Funktionen bei OK - schliessen ++++++"
|
||||
Function CheckWrite_IndexeMan(dokartid As Integer)
|
||||
Function CheckWrite_IndexeMan(oDocumentTypeId As Integer)
|
||||
'#### Zuerst manuelle Werte indexieren ####
|
||||
Try
|
||||
_Logger.Info("In CheckWrite_IndexeMan")
|
||||
Dim result As Boolean = False
|
||||
Dim oResult As Boolean = False
|
||||
For Each oControl As Control In Me.pnlIndex.Controls
|
||||
' MsgBox(ctrl.Name)
|
||||
If oControl.Name.StartsWith("txt") Then
|
||||
Dim box As DevExpress.XtraEditors.TextEdit = oControl
|
||||
If box.Text = "" Then
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(box.Name, "txt", "") & "'", MyConnectionString, True)
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(box.Name, "txt", "") & "'", MyConnectionString, True)
|
||||
If optional_index = False Then
|
||||
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
@@ -336,7 +335,7 @@ Public Class frmIndex
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(box.Name, "txt", ""), "")
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
Else
|
||||
If Indexwert_checkValueDB(Replace(box.Name, "txt", ""), box.Text) = False Then
|
||||
@@ -356,19 +355,19 @@ Public Class frmIndex
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(box.Name, "txt", ""), box.Text)
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If oControl.Name.StartsWith("cmbMulti") Then
|
||||
Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3)
|
||||
Dim values As List(Of String) = oLookup.Properties.SelectedValues
|
||||
Dim oValues As List(Of String) = oLookup.Properties.SelectedValues
|
||||
|
||||
If values.Count = 0 Then
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'", MyConnectionString, True)
|
||||
If oValues.Count = 0 Then
|
||||
Dim oIsOptionalIndex As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'", MyConnectionString, True)
|
||||
|
||||
If optional_index = False Then
|
||||
If oIsOptionalIndex = False Then
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text)
|
||||
Else
|
||||
@@ -379,18 +378,18 @@ Public Class frmIndex
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), "")
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
Else
|
||||
Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, values)
|
||||
Dim vectorValue = String.Join(ClassConstants.VECTORSEPARATOR, oValues)
|
||||
Indexwert_Postprocessing(Replace(oLookup.Name, "cmbMulti", ""), vectorValue)
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
ElseIf oControl.Name.StartsWith("cmbSingle") Then
|
||||
Dim cmbSingle As TextBox = oControl
|
||||
|
||||
If cmbSingle.Text = "" Then
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(cmbSingle.Name, "cmbSingle", "") & "'", MyConnectionString, True)
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmbSingle.Name, "cmbSingle", "") & "'", MyConnectionString, True)
|
||||
|
||||
If optional_index = False Then
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
@@ -402,16 +401,16 @@ Public Class frmIndex
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), "")
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(cmbSingle.Name, "cmbSingle", ""), cmbSingle.Text)
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
ElseIf oControl.Name.StartsWith("cmb") Then
|
||||
Dim cmb As ComboBox = oControl
|
||||
If cmb.Text = "" Then
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(cmb.Name, "cmb", "") & "'", MyConnectionString, True)
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & oDocumentTypeId & " AND NAME = '" & Replace(cmb.Name, "cmb", "") & "'", MyConnectionString, True)
|
||||
If optional_index = False Then
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
MsgBox(TEXT_MISSING_INPUT_DE, MsgBoxStyle.Exclamation, Text)
|
||||
@@ -422,11 +421,11 @@ Public Class frmIndex
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), "")
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(cmb.Name, "cmb", ""), cmb.Text)
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
End If
|
||||
If oControl.Name.StartsWith("dtp") Then
|
||||
@@ -434,7 +433,7 @@ Public Class frmIndex
|
||||
Dim oIndexName As String = Replace(dtp.Name, "dtp", "")
|
||||
|
||||
If dtp.Text = String.Empty Then
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {dokartid} AND NAME = '{oIndexName}'", MyConnectionString, True)
|
||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar($"SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = {oDocumentTypeId} AND NAME = '{oIndexName}'", MyConnectionString, True)
|
||||
|
||||
If optional_index = False Then
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
@@ -446,22 +445,22 @@ Public Class frmIndex
|
||||
Return False
|
||||
Else
|
||||
Indexwert_Postprocessing(oIndexName, "")
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
Else
|
||||
Indexwert_Postprocessing(Replace(dtp.Name, "dtp", ""), dtp.Text)
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
End If
|
||||
If oControl.Name.StartsWith("chk") Then
|
||||
Dim chk As CheckBox = oControl
|
||||
Indexwert_Postprocessing(Replace(chk.Name, "chk", ""), chk.Checked)
|
||||
result = True
|
||||
oResult = True
|
||||
End If
|
||||
If TypeOf (oControl) Is Button Then
|
||||
Continue For
|
||||
End If
|
||||
If oControl.Name.StartsWith("lbl") = False And result = False Then
|
||||
If oControl.Name.StartsWith("lbl") = False And oResult = False Then
|
||||
_Logger.Info(TEXT_CHECK_MANUAL_INDEXES_EN)
|
||||
Return False
|
||||
End If
|
||||
@@ -871,8 +870,7 @@ Public Class frmIndex
|
||||
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 oMail As IMail = EMAIL.Load_Email(oMsgFilePath)
|
||||
|
||||
Dim oSQL As String = $"SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '{CURR_DOKART_OBJECTTYPE}'"
|
||||
Dim oTable As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
||||
@@ -893,8 +891,8 @@ Public Class frmIndex
|
||||
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 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
|
||||
|
||||
@@ -913,18 +911,29 @@ Public Class frmIndex
|
||||
|
||||
For Each oIndex In oIndexNames
|
||||
Try
|
||||
If oIndex.Value Is Nothing OrElse oIndex.Value = String.Empty Then
|
||||
If oIndex.Value Is Nothing Then
|
||||
LOGGER.Warn("Value for Index [{0}] was empty. Skipping.", oIndex.Key)
|
||||
Return False
|
||||
|
||||
End If
|
||||
|
||||
If TypeOf oIndex.Value Is String AndAlso oIndex.Value = String.Empty Then
|
||||
LOGGER.Warn("Value for Index [{0}] was empty. Skipping.", oIndex.Key)
|
||||
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)
|
||||
MsgBox($"Error while Indexing Email at Index [{oIndex.Key}]", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Error while Indexing Email at Index [{0}]", oIndex.Key)
|
||||
LOGGER.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
@@ -937,383 +946,384 @@ Public Class frmIndex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function SetEmailIndicesOld()
|
||||
Dim indexierung_erfolgreich As Boolean = False
|
||||
Dim _step As String = "1"
|
||||
'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)
|
||||
Dim msgDisplayTo = msg.DisplayTo
|
||||
Dim msgInternetAccountName = msg.InternetAccountName
|
||||
If LogErrorsOnly = False Then
|
||||
_Logger.Info("")
|
||||
_Logger.Info("msgInternetAccountName: " & msgInternetAccountName)
|
||||
_Logger.Info("SenderName: " & msg.SenderName)
|
||||
_Logger.Info("SenderEmailAddress: " & msg.SenderEmailAddress)
|
||||
_Logger.Info("ReceivedByName: " & msg.ReceivedByName)
|
||||
_Logger.Info("ReceivedByEmailAddress: " & msg.ReceivedByEmailAddress)
|
||||
_Logger.Info("")
|
||||
End If
|
||||
_step = "2"
|
||||
' Try
|
||||
' Dim oTempPath As String = Path.Combine("\\windream\objects", CURRENT_NEWFILENAME)
|
||||
' Dim msg As Msg.Message = New Msg.Message(oTempPath)
|
||||
' Dim msgDisplayTo = msg.DisplayTo
|
||||
' Dim msgInternetAccountName = msg.InternetAccountName
|
||||
' If LogErrorsOnly = False Then
|
||||
' _Logger.Info("")
|
||||
' _Logger.Info("msgInternetAccountName: " & msgInternetAccountName)
|
||||
' _Logger.Info("SenderName: " & msg.SenderName)
|
||||
' _Logger.Info("SenderEmailAddress: " & msg.SenderEmailAddress)
|
||||
' _Logger.Info("ReceivedByName: " & msg.ReceivedByName)
|
||||
' _Logger.Info("ReceivedByEmailAddress: " & msg.ReceivedByEmailAddress)
|
||||
' _Logger.Info("")
|
||||
' End If
|
||||
' _step = "2"
|
||||
|
||||
'Console.WriteLine("Subject: " + msg.Subject)
|
||||
'Console.WriteLine("MessageDeliveryTime:" & msg.MessageDeliveryTime)
|
||||
'Console.WriteLine("SenderName: " + msg.SenderName)
|
||||
'Console.WriteLine("SenderEmailAddress: " + msg.SenderEmailAddress)
|
||||
'Console.WriteLine("ReceivedByName: " + msg.ReceivedByName)
|
||||
'Console.WriteLine("ReceivedByEmailAddress: " + msg.ReceivedByEmailAddress)
|
||||
'Console.WriteLine("DisplayTo: " + msg.DisplayTo)
|
||||
'Console.WriteLine("DisplayCc: " + msg.DisplayCc)
|
||||
'Console.WriteLine("Body: " + msg.Body)
|
||||
'Console.WriteLine("-----------------------------------------------------------------------")
|
||||
'Console.WriteLine("BodyHtmlText: " + msg.BodyHtmlText)
|
||||
Dim fromPattern As String = ""
|
||||
Dim toPattern As String = ""
|
||||
Dim messageIDPattern As String = ""
|
||||
Dim finalize_pattern As String = ""
|
||||
' 'Console.WriteLine("Subject: " + msg.Subject)
|
||||
' 'Console.WriteLine("MessageDeliveryTime:" & msg.MessageDeliveryTime)
|
||||
' 'Console.WriteLine("SenderName: " + msg.SenderName)
|
||||
' 'Console.WriteLine("SenderEmailAddress: " + msg.SenderEmailAddress)
|
||||
' 'Console.WriteLine("ReceivedByName: " + msg.ReceivedByName)
|
||||
' 'Console.WriteLine("ReceivedByEmailAddress: " + msg.ReceivedByEmailAddress)
|
||||
' 'Console.WriteLine("DisplayTo: " + msg.DisplayTo)
|
||||
' 'Console.WriteLine("DisplayCc: " + msg.DisplayCc)
|
||||
' 'Console.WriteLine("Body: " + msg.Body)
|
||||
' 'Console.WriteLine("-----------------------------------------------------------------------")
|
||||
' 'Console.WriteLine("BodyHtmlText: " + msg.BodyHtmlText)
|
||||
' Dim fromPattern As String = ""
|
||||
' Dim toPattern As String = ""
|
||||
' Dim messageIDPattern As String = ""
|
||||
' Dim finalize_pattern As String = ""
|
||||
|
||||
' Email Header auslesen
|
||||
Dim headers As String = ClassEmailHeaderExtractor.getMessageHeaders(msg)
|
||||
' ' Email Header auslesen
|
||||
' Dim headers As String = ClassEmailHeaderExtractor.getMessageHeaders(msg)
|
||||
|
||||
For Each rowregex As DataRow In CURRENT_DT_REGEX.Rows
|
||||
If rowregex.Item("FUNCTION_NAME") = "FROM_EMAIL_HEADER" Then
|
||||
fromPattern = rowregex.Item("REGEX")
|
||||
ElseIf rowregex.Item("FUNCTION_NAME") = "TO_EMAIL_HEADER" Then
|
||||
toPattern = rowregex.Item("REGEX")
|
||||
ElseIf rowregex.Item("FUNCTION_NAME") = "MESSAGE_ID" Then
|
||||
messageIDPattern = rowregex.Item("REGEX")
|
||||
ElseIf rowregex.Item("FUNCTION_NAME") = "FINALIZE" Then
|
||||
finalize_pattern = rowregex.Item("REGEX")
|
||||
End If
|
||||
Next
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "'")
|
||||
If IsNothing(DT) Then
|
||||
_Logger.Info("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "' RESULTED in NOTHING")
|
||||
Return False
|
||||
End If
|
||||
If DT.Rows.Count = 1 Then
|
||||
_step = "3"
|
||||
CURRENT_MESSAGEDATE = ""
|
||||
CURRENT_MESSAGESUBJECT = ""
|
||||
'Message-ID nur auswerten wenn vorher nicht gestzt wurde!
|
||||
If CURRENT_MESSAGEID = "" Then
|
||||
If Not msg.InternetMessageId Is Nothing Then
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, msg.InternetMessageId)
|
||||
'Die aktuelle Message-ID zwischenspeichern
|
||||
CURRENT_MESSAGEID = msg.InternetMessageId
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
If messageIDPattern = String.Empty Then
|
||||
_Logger.Info("A messageID could not be read!")
|
||||
Else
|
||||
If Not IsNothing(headers) Then
|
||||
CURRENT_MESSAGEID = ClassEmailHeaderExtractor.extractFromHeader(headers, messageIDPattern)
|
||||
If IsNothing(CURRENT_MESSAGEID) Then
|
||||
CURRENT_MESSAGEID = ""
|
||||
End If
|
||||
Else
|
||||
_Logger.Info("A messageID could not be read - messageheader nothing/messagIDpattern value!")
|
||||
End If
|
||||
End If
|
||||
' For Each rowregex As DataRow In CURRENT_DT_REGEX.Rows
|
||||
' If rowregex.Item("FUNCTION_NAME") = "FROM_EMAIL_HEADER" Then
|
||||
' fromPattern = rowregex.Item("REGEX")
|
||||
' ElseIf rowregex.Item("FUNCTION_NAME") = "TO_EMAIL_HEADER" Then
|
||||
' toPattern = rowregex.Item("REGEX")
|
||||
' ElseIf rowregex.Item("FUNCTION_NAME") = "MESSAGE_ID" Then
|
||||
' messageIDPattern = rowregex.Item("REGEX")
|
||||
' ElseIf rowregex.Item("FUNCTION_NAME") = "FINALIZE" Then
|
||||
' finalize_pattern = rowregex.Item("REGEX")
|
||||
' End If
|
||||
' Next
|
||||
' Dim DT As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "'")
|
||||
' If IsNothing(DT) Then
|
||||
' _Logger.Info("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "' RESULTED in NOTHING")
|
||||
' Return False
|
||||
' End If
|
||||
' If DT.Rows.Count = 1 Then
|
||||
' _step = "3"
|
||||
' CURRENT_MESSAGEDATE = ""
|
||||
' CURRENT_MESSAGESUBJECT = ""
|
||||
' 'Message-ID nur auswerten wenn vorher nicht gestzt wurde!
|
||||
' If CURRENT_MESSAGEID = "" Then
|
||||
' If Not msg.InternetMessageId Is Nothing Then
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, msg.InternetMessageId)
|
||||
' 'Die aktuelle Message-ID zwischenspeichern
|
||||
' CURRENT_MESSAGEID = msg.InternetMessageId
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' Else
|
||||
' If messageIDPattern = String.Empty Then
|
||||
' _Logger.Info("A messageID could not be read!")
|
||||
' Else
|
||||
' If Not IsNothing(headers) Then
|
||||
' CURRENT_MESSAGEID = ClassEmailHeaderExtractor.extractFromHeader(headers, messageIDPattern)
|
||||
' If IsNothing(CURRENT_MESSAGEID) Then
|
||||
' CURRENT_MESSAGEID = ""
|
||||
' End If
|
||||
' Else
|
||||
' _Logger.Info("A messageID could not be read - messageheader nothing/messagIDpattern value!")
|
||||
' End If
|
||||
' End If
|
||||
|
||||
End If
|
||||
Else
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, CURRENT_MESSAGEID)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
_step = "4"
|
||||
' Regular Expressions vorbereiten
|
||||
' End If
|
||||
' Else
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, CURRENT_MESSAGEID)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetEmailIndices-EmailID - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
' _step = "4"
|
||||
' ' Regular Expressions vorbereiten
|
||||
|
||||
If fromPattern <> "" And toPattern <> "" Then
|
||||
_step = "4.1"
|
||||
Dim FromRegexList As New List(Of Regex)
|
||||
Dim ToRegexList As New List(Of Regex)
|
||||
Dim fromRegex As New Regex(fromPattern, RegexOptions.IgnoreCase)
|
||||
Dim toRegex As New Regex(toPattern, RegexOptions.IgnoreCase)
|
||||
' If fromPattern <> "" And toPattern <> "" Then
|
||||
' _step = "4.1"
|
||||
' Dim FromRegexList As New List(Of Regex)
|
||||
' Dim ToRegexList As New List(Of Regex)
|
||||
' Dim fromRegex As New Regex(fromPattern, RegexOptions.IgnoreCase)
|
||||
' Dim toRegex As New Regex(toPattern, RegexOptions.IgnoreCase)
|
||||
|
||||
FromRegexList.Add(fromRegex)
|
||||
ToRegexList.Add(toRegex)
|
||||
' FromRegexList.Add(fromRegex)
|
||||
' ToRegexList.Add(toRegex)
|
||||
|
||||
|
||||
Dim emailFrom
|
||||
Dim emailTo
|
||||
' Email Absender und Empfänger
|
||||
If headers Is Nothing Then
|
||||
_step = "4.2"
|
||||
If IsNothing(msgDisplayTo) Then
|
||||
_step = "4.3"
|
||||
_Logger.Info("DisplayTo in email is nothing - default will be set")
|
||||
emailTo = "NO RECIPIENT"
|
||||
Else
|
||||
_step = "4.4"
|
||||
emailTo = msgDisplayTo.ToString.Replace("'", "")
|
||||
End If
|
||||
If IsNothing(msgInternetAccountName) Then
|
||||
_step = "4.5"
|
||||
_Logger.Info("InternetAccountName in email is nothing - default will be set")
|
||||
emailFrom = ""
|
||||
Else
|
||||
_step = "4.6"
|
||||
emailFrom = msgInternetAccountName.ToString.Replace("'", "")
|
||||
End If
|
||||
Else
|
||||
_step = "5"
|
||||
_Logger.Info("emailTo and From Extraction via messageheader.")
|
||||
emailFrom = ClassEmailHeaderExtractor.extractFromHeader(headers, fromPattern) 'FromRegexList)
|
||||
emailTo = ClassEmailHeaderExtractor.extractFromHeader(headers, toPattern) ' extractToAddress(headers, ToRegexList)
|
||||
' Dim emailFrom
|
||||
' Dim emailTo
|
||||
' ' Email Absender und Empfänger
|
||||
' If headers Is Nothing Then
|
||||
' _step = "4.2"
|
||||
' If IsNothing(msgDisplayTo) Then
|
||||
' _step = "4.3"
|
||||
' _Logger.Info("DisplayTo in email is nothing - default will be set")
|
||||
' emailTo = "NO RECIPIENT"
|
||||
' Else
|
||||
' _step = "4.4"
|
||||
' emailTo = msgDisplayTo.ToString.Replace("'", "")
|
||||
' End If
|
||||
' If IsNothing(msgInternetAccountName) Then
|
||||
' _step = "4.5"
|
||||
' _Logger.Info("InternetAccountName in email is nothing - default will be set")
|
||||
' emailFrom = ""
|
||||
' Else
|
||||
' _step = "4.6"
|
||||
' emailFrom = msgInternetAccountName.ToString.Replace("'", "")
|
||||
' End If
|
||||
' Else
|
||||
' _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
|
||||
If IsNothing(emailTo) Then
|
||||
_step = "5.1"
|
||||
_Logger.Info("emailTo couldn't be extracted from messageheader...")
|
||||
If (headers.Contains("exc") Or headers.Contains("exchange")) Then
|
||||
_step = "5.2"
|
||||
_Logger.Info("...try with LDAP-option")
|
||||
Dim _email = GetUserEmailfromLDAP(msgDisplayTo)
|
||||
_step = "5.3"
|
||||
If _email <> "" Then
|
||||
emailTo = _email
|
||||
Else
|
||||
_Logger.Info(">> email-adress couldn't be read from LDAP with name '" & msgDisplayTo & "'")
|
||||
MsgBox("Could't get 'emailto' from messageHeader and later on with LDAP-Option." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation)
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
_step = "5.4"
|
||||
CURR_MISSING_PATTERN_NAME = "Email To"
|
||||
CURR_MISSING_SEARCH_STRING = headers
|
||||
CURR_MISSING_MANUAL_VALUE = String.Empty
|
||||
frmMissingInput.ShowDialog()
|
||||
_step = "5.4.1"
|
||||
If CURR_MISSING_MANUAL_VALUE <> String.Empty Then
|
||||
_step = "5.4.2"
|
||||
emailTo = CURR_MISSING_MANUAL_VALUE
|
||||
Else
|
||||
_step = "5.4.3"
|
||||
_Logger.Info("no exchange patterns found in headers!")
|
||||
MsgBox("Could't get 'emailto' from messageHeader and exhange-Patterns weren't found." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation)
|
||||
Return False
|
||||
End If
|
||||
' 'Handler für leere emailTo-Adresse
|
||||
' If IsNothing(emailTo) Then
|
||||
' _step = "5.1"
|
||||
' _Logger.Info("emailTo couldn't be extracted from messageheader...")
|
||||
' If (headers.Contains("exc") Or headers.Contains("exchange")) Then
|
||||
' _step = "5.2"
|
||||
' _Logger.Info("...try with LDAP-option")
|
||||
' Dim _email = GetUserEmailfromLDAP(msgDisplayTo)
|
||||
' _step = "5.3"
|
||||
' If _email <> "" Then
|
||||
' emailTo = _email
|
||||
' Else
|
||||
' _Logger.Info(">> email-adress couldn't be read from LDAP with name '" & msgDisplayTo & "'")
|
||||
' MsgBox("Could't get 'emailto' from messageHeader and later on with LDAP-Option." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation)
|
||||
' Return False
|
||||
' End If
|
||||
' Else
|
||||
' _step = "5.4"
|
||||
' CURR_MISSING_PATTERN_NAME = "Email To"
|
||||
' CURR_MISSING_SEARCH_STRING = headers
|
||||
' CURR_MISSING_MANUAL_VALUE = String.Empty
|
||||
' frmMissingInput.ShowDialog()
|
||||
' _step = "5.4.1"
|
||||
' If CURR_MISSING_MANUAL_VALUE <> String.Empty Then
|
||||
' _step = "5.4.2"
|
||||
' emailTo = CURR_MISSING_MANUAL_VALUE
|
||||
' Else
|
||||
' _step = "5.4.3"
|
||||
' _Logger.Info("no exchange patterns found in headers!")
|
||||
' MsgBox("Could't get 'emailto' from messageHeader and exhange-Patterns weren't found." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation)
|
||||
' Return False
|
||||
' End If
|
||||
|
||||
End If
|
||||
End If
|
||||
_step = "6"
|
||||
emailTo = ClassEmailHeaderExtractor.extractFromHeader(emailTo, finalize_pattern)
|
||||
emailFrom = ClassEmailHeaderExtractor.extractFromHeader(emailFrom, finalize_pattern)
|
||||
_step = "6.1"
|
||||
' End If
|
||||
' End If
|
||||
' _step = "6"
|
||||
' 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(">", "")
|
||||
Else
|
||||
_step = "6.1.x"
|
||||
_Logger.Info("emailFrom is Nothing?!")
|
||||
End If
|
||||
' If Not IsNothing(emailFrom) Then
|
||||
' emailFrom = emailFrom.Replace("<", "")
|
||||
' emailFrom = emailFrom.Replace(">", "")
|
||||
' Else
|
||||
' _step = "6.1.x"
|
||||
' _Logger.Info("emailFrom is Nothing?!")
|
||||
' End If
|
||||
|
||||
If Not IsNothing(emailTo) Then
|
||||
_step = "6.1.1 " & emailTo.ToString
|
||||
emailTo = emailTo.Replace("<", "")
|
||||
emailTo = emailTo.Replace(">", "")
|
||||
_step = "6.2"
|
||||
Dim _duplicatesCheck As List(Of String) = New List(Of String)
|
||||
_duplicatesCheck = emailTo.ToString.Split(";").ToList
|
||||
' Filter distinct elements, and convert back into list.
|
||||
Dim result As List(Of String) = _duplicatesCheck.Distinct().ToList
|
||||
' Display result.
|
||||
Dim i As Integer = 0
|
||||
For Each element As String In result
|
||||
If i = 0 Then
|
||||
emailTo = element
|
||||
Else
|
||||
emailTo = emailTo & ";" & element
|
||||
End If
|
||||
i += 1
|
||||
Next
|
||||
Else
|
||||
_step = "6.3"
|
||||
_Logger.Info("emailTo is Nothing?!")
|
||||
End If
|
||||
' If Not IsNothing(emailTo) Then
|
||||
' _step = "6.1.1 " & emailTo.ToString
|
||||
' emailTo = emailTo.Replace("<", "")
|
||||
' emailTo = emailTo.Replace(">", "")
|
||||
' _step = "6.2"
|
||||
' Dim _duplicatesCheck As List(Of String) = New List(Of String)
|
||||
' _duplicatesCheck = emailTo.ToString.Split(";").ToList
|
||||
' ' Filter distinct elements, and convert back into list.
|
||||
' Dim result As List(Of String) = _duplicatesCheck.Distinct().ToList
|
||||
' ' Display result.
|
||||
' Dim i As Integer = 0
|
||||
' For Each element As String In result
|
||||
' If i = 0 Then
|
||||
' emailTo = element
|
||||
' Else
|
||||
' emailTo = emailTo & ";" & element
|
||||
' End If
|
||||
' i += 1
|
||||
' Next
|
||||
' Else
|
||||
' _step = "6.3"
|
||||
' _Logger.Info("emailTo is Nothing?!")
|
||||
' End If
|
||||
|
||||
_Logger.Info("Headers-Content: ")
|
||||
_Logger.Info(headers.ToString)
|
||||
End If
|
||||
'Handler für leere emailFrom-Adresse
|
||||
If IsNothing(emailFrom) Then
|
||||
_step = "7"
|
||||
_Logger.Info("emailFrom couldn't be extracted from messageheader...")
|
||||
If Not IsNothing(msg.SenderEmailAddress) Then
|
||||
If msg.SenderEmailAddress <> String.Empty Then
|
||||
_step = "7.1"
|
||||
_Logger.Info("emailFrom via msg.SenderEmailAddress will be used instead!")
|
||||
emailFrom = msg.SenderEmailAddress.ToString.Replace("'", "")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
If IsNothing(emailFrom) Or emailFrom = String.Empty Then
|
||||
_step = "7.2"
|
||||
CURR_MISSING_PATTERN_NAME = "Email From"
|
||||
CURR_MISSING_SEARCH_STRING = emailFrom
|
||||
CURR_MISSING_MANUAL_VALUE = String.Empty
|
||||
frmMissingInput.ShowDialog()
|
||||
If CURR_MISSING_MANUAL_VALUE <> String.Empty Then
|
||||
_step = "7.3"
|
||||
emailFrom = CURR_MISSING_MANUAL_VALUE
|
||||
Else
|
||||
MsgBox("Could't get 'emailfrom' from messageHeader." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
' _Logger.Info("Headers-Content: ")
|
||||
' _Logger.Info(headers.ToString)
|
||||
' End If
|
||||
' 'Handler für leere emailFrom-Adresse
|
||||
' If IsNothing(emailFrom) Then
|
||||
' _step = "7"
|
||||
' _Logger.Info("emailFrom couldn't be extracted from messageheader...")
|
||||
' If Not IsNothing(msg.SenderEmailAddress) Then
|
||||
' If msg.SenderEmailAddress <> String.Empty Then
|
||||
' _step = "7.1"
|
||||
' _Logger.Info("emailFrom via msg.SenderEmailAddress will be used instead!")
|
||||
' emailFrom = msg.SenderEmailAddress.ToString.Replace("'", "")
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' If IsNothing(emailFrom) Or emailFrom = String.Empty Then
|
||||
' _step = "7.2"
|
||||
' CURR_MISSING_PATTERN_NAME = "Email From"
|
||||
' CURR_MISSING_SEARCH_STRING = emailFrom
|
||||
' CURR_MISSING_MANUAL_VALUE = String.Empty
|
||||
' frmMissingInput.ShowDialog()
|
||||
' If CURR_MISSING_MANUAL_VALUE <> String.Empty Then
|
||||
' _step = "7.3"
|
||||
' emailFrom = CURR_MISSING_MANUAL_VALUE
|
||||
' Else
|
||||
' MsgBox("Could't get 'emailfrom' from messageHeader." & vbNewLine & "Please check the dropped email and Configuration of Email-Indexing!", MsgBoxStyle.Exclamation)
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
|
||||
_Logger.Info("emailFrom: " & emailFrom)
|
||||
_Logger.Info("emailTo: " & emailTo)
|
||||
'FROM
|
||||
If Not IsNothing(emailFrom) Then
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_FROM").ToString, emailFrom)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices [emailFrom] - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
_Logger.Info("emailFrom is still Nothing?!")
|
||||
_step = "7.4"
|
||||
End If
|
||||
'TO
|
||||
If Not IsNothing(emailTo) Then
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_TO").ToString, emailTo)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices [emailTo] - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
_Logger.Info("emailTo is still Nothing?!")
|
||||
_step = "7.5"
|
||||
End If
|
||||
' _Logger.Info("emailFrom: " & emailFrom)
|
||||
' _Logger.Info("emailTo: " & emailTo)
|
||||
' 'FROM
|
||||
' If Not IsNothing(emailFrom) Then
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_FROM").ToString, emailFrom)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetEmailIndices [emailFrom] - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' Else
|
||||
' _Logger.Info("emailFrom is still Nothing?!")
|
||||
' _step = "7.4"
|
||||
' End If
|
||||
' 'TO
|
||||
' If Not IsNothing(emailTo) Then
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_TO").ToString, emailTo)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetEmailIndices [emailTo] - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' Else
|
||||
' _Logger.Info("emailTo is still Nothing?!")
|
||||
' _step = "7.5"
|
||||
' End If
|
||||
|
||||
' Dim subj As String = ClassFormFunctions.CleanInput(msg.Subject)
|
||||
Dim subj As String = msg.Subject
|
||||
If IsNothing(subj) Or subj = "" Then
|
||||
_Logger.Info("msg subject is empty...DEFAULT will be set")
|
||||
subj = "No subject"
|
||||
MsgBox("Attention: Email was send without a subject - Default value 'No subject' will be used!", MsgBoxStyle.Exclamation)
|
||||
Else
|
||||
subj = ClassHelper.encode_utf8(msg.Subject)
|
||||
If IsNothing(subj) Then
|
||||
subj = msg.Subject
|
||||
End If
|
||||
End If
|
||||
' ' Dim subj As String = ClassFormFunctions.CleanInput(msg.Subject)
|
||||
' Dim subj As String = msg.Subject
|
||||
' If IsNothing(subj) Or subj = "" Then
|
||||
' _Logger.Info("msg subject is empty...DEFAULT will be set")
|
||||
' subj = "No subject"
|
||||
' MsgBox("Attention: Email was send without a subject - Default value 'No subject' will be used!", MsgBoxStyle.Exclamation)
|
||||
' Else
|
||||
' subj = ClassHelper.encode_utf8(msg.Subject)
|
||||
' If IsNothing(subj) Then
|
||||
' subj = msg.Subject
|
||||
' End If
|
||||
' End If
|
||||
|
||||
_Logger.Info("Now all email-items will be indexed!")
|
||||
' _Logger.Info("Now all email-items will be indexed!")
|
||||
|
||||
_Logger.Info("subj: " & subj)
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, subj)
|
||||
CURRENT_MESSAGESUBJECT = subj
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices [Subject] - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
_Logger.Info("MessageDeliveryTime: " & msg.MessageDeliveryTime)
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, msg.MessageDeliveryTime)
|
||||
CURRENT_MESSAGEDATE = msg.MessageDeliveryTime
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetEmailIndices [Datein] - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
indexierung_erfolgreich = False
|
||||
End If
|
||||
' _Logger.Info("subj: " & subj)
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, subj)
|
||||
' CURRENT_MESSAGESUBJECT = subj
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetEmailIndices [Subject] - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' _Logger.Info("MessageDeliveryTime: " & msg.MessageDeliveryTime)
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, msg.MessageDeliveryTime)
|
||||
' CURRENT_MESSAGEDATE = msg.MessageDeliveryTime
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetEmailIndices [Datein] - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' Else
|
||||
' indexierung_erfolgreich = False
|
||||
' End If
|
||||
|
||||
Return indexierung_erfolgreich
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowErrorMessage(ex, "SetEmailIndices")
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Function GetUserEmailfromLDAP(ByVal userName As String) As String
|
||||
' Return indexierung_erfolgreich
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' ShowErrorMessage(ex, "SetEmailIndices")
|
||||
' Return False
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Dim domainName As String = Environment.UserDomainName '"PutYourDomainNameHere" '< Change this value to your actual domain name. For example: "yahoo"
|
||||
Dim dommain As String = "com" '<change this value to your actual domain region. For example: "com" as in "yahoo.com"
|
||||
'Public Function GetUserEmailfromLDAP(ByVal userName As String) As String
|
||||
|
||||
Dim path As String = String.Format("LDAP://CN=User,DC={0}", domainName)
|
||||
Dim userEmail As String = String.Empty
|
||||
' Dim domainName As String = Environment.UserDomainName '"PutYourDomainNameHere" '< Change this value to your actual domain name. For example: "yahoo"
|
||||
' Dim dommain As String = "com" '<change this value to your actual domain region. For example: "com" as in "yahoo.com"
|
||||
|
||||
Using search As DirectorySearcher = New DirectorySearcher(path)
|
||||
Dim result As SearchResult
|
||||
Try
|
||||
search.Filter = "(SAMAccountName=" & userName & ")"
|
||||
search.PropertiesToLoad.Add("mail")
|
||||
result = search.FindOne()
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
search.Filter = ""
|
||||
search.Filter = "(GivenName=" & userName & ")"
|
||||
search.PropertiesToLoad.Add("mail")
|
||||
End Try
|
||||
' Dim path As String = String.Format("LDAP://CN=User,DC={0}", domainName)
|
||||
' Dim userEmail As String = String.Empty
|
||||
|
||||
Try
|
||||
result = search.FindOne()
|
||||
If result IsNot Nothing Then userEmail = result.Properties("mail").ToString
|
||||
Catch ex As Exception
|
||||
_Logger.Info(">> Unexpected Error in GetUserEmail from LDAP: " & ex.Message)
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Using
|
||||
' Using search As DirectorySearcher = New DirectorySearcher(path)
|
||||
' Dim result As SearchResult
|
||||
' Try
|
||||
' search.Filter = "(SAMAccountName=" & userName & ")"
|
||||
' search.PropertiesToLoad.Add("mail")
|
||||
' result = search.FindOne()
|
||||
' Catch ex As Exception
|
||||
' _Logger.Error(ex)
|
||||
' search.Filter = ""
|
||||
' search.Filter = "(GivenName=" & userName & ")"
|
||||
' search.PropertiesToLoad.Add("mail")
|
||||
' End Try
|
||||
|
||||
Return userEmail
|
||||
' Try
|
||||
' result = search.FindOne()
|
||||
' If result IsNot Nothing Then userEmail = result.Properties("mail").ToString
|
||||
' Catch ex As Exception
|
||||
' _Logger.Info(">> Unexpected Error in GetUserEmail from LDAP: " & ex.Message)
|
||||
' _Logger.Error(ex)
|
||||
' End Try
|
||||
' End Using
|
||||
|
||||
End Function
|
||||
Private Function SetAttachmentIndices()
|
||||
Dim indexierung_erfolgreich As Boolean = True
|
||||
Try
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "'")
|
||||
If DT.Rows.Count = 1 Then
|
||||
' Return userEmail
|
||||
|
||||
If Not CURRENT_MESSAGEID Is Nothing Then
|
||||
If CURRENT_MESSAGEID <> "" Then
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, CURRENT_MESSAGEID)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetAttachmentIndices MESSAGE-ID - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
'Das Subject speichern
|
||||
If CURRENT_MESSAGESUBJECT <> "" Then
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, CURRENT_MESSAGESUBJECT)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetAttachmentIndices SUBJECT - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
'Das MesageDate speichern
|
||||
If CURRENT_MESSAGEDATE <> "" Then
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, CURRENT_MESSAGEDATE)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetAttachmentIndices DATE - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
'Kennzeichnen das es ein Anhang war!
|
||||
indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_CHECK_ATTACHMENT").ToString, True)
|
||||
If indexierung_erfolgreich = False Then
|
||||
MsgBox("Error in SetAttachmentIndices ATTACHMENT Y/N - See log", MsgBoxStyle.Critical)
|
||||
Return False
|
||||
End If
|
||||
Return indexierung_erfolgreich
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowErrorMessage(ex, "SetAttachmentIndices")
|
||||
Return False
|
||||
End Try
|
||||
'End Function
|
||||
'Private Function SetAttachmentIndices()
|
||||
' Dim indexierung_erfolgreich As Boolean = True
|
||||
' Try
|
||||
' Dim DT As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = '" & CURR_DOKART_OBJECTTYPE & "'")
|
||||
' If DT.Rows.Count = 1 Then
|
||||
|
||||
End Function
|
||||
' If Not CURRENT_MESSAGEID Is Nothing Then
|
||||
' If CURRENT_MESSAGEID <> "" Then
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_ID").ToString, CURRENT_MESSAGEID)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetAttachmentIndices MESSAGE-ID - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' 'Das Subject speichern
|
||||
' If CURRENT_MESSAGESUBJECT <> "" Then
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_SUBJECT").ToString, CURRENT_MESSAGESUBJECT)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetAttachmentIndices SUBJECT - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
' 'Das MesageDate speichern
|
||||
' If CURRENT_MESSAGEDATE <> "" Then
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_EMAIL_DATE_IN").ToString, CURRENT_MESSAGEDATE)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetAttachmentIndices DATE - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
' 'Kennzeichnen das es ein Anhang war!
|
||||
' indexierung_erfolgreich = WriteIndex2File(DT.Rows(0).Item("IDX_CHECK_ATTACHMENT").ToString, True)
|
||||
' If indexierung_erfolgreich = False Then
|
||||
' MsgBox("Error in SetAttachmentIndices ATTACHMENT Y/N - See log", MsgBoxStyle.Critical)
|
||||
' Return False
|
||||
' End If
|
||||
' Return indexierung_erfolgreich
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' ShowErrorMessage(ex, "SetAttachmentIndices")
|
||||
' Return False
|
||||
' End Try
|
||||
|
||||
'End Function
|
||||
|
||||
Private Function SINGLEFILE_2_WINDREAM(_Objekttyp As String) As Boolean
|
||||
Try
|
||||
@@ -1402,25 +1412,25 @@ Public Class frmIndex
|
||||
Select Case CancelAttempts
|
||||
Case 0
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
MsgBox("Bitte indexieren Sie die Datei vollständig!" & vbNewLine & "(Abbruch 1 des Indexierungsvorgangs)", MsgBoxStyle.Information)
|
||||
MsgBox($"Bitte indexieren Sie die Datei vollständig!{vbNewLine}(Abbruch 1 des Indexierungsvorgangs)", MsgBoxStyle.Information)
|
||||
Else
|
||||
MsgBox("Please Index file completely" & vbNewLine & "(Abort 1 of Indexdialog)", MsgBoxStyle.Information)
|
||||
MsgBox($"Please Index file completely{vbNewLine}(Abort 1 of Indexdialog)", MsgBoxStyle.Information)
|
||||
End If
|
||||
CancelAttempts = CancelAttempts + 1
|
||||
e.Cancel = True
|
||||
Case 1
|
||||
Dim result As MsgBoxResult
|
||||
If USER_LANGUAGE = LANG_DE Then
|
||||
result = MessageBox.Show("Sie brechen nun zum zweiten Mal den Indexierungsvorgang ab!" & vbNewLine & "Wollen Sie die Indexierung aller Dateien abbrechen?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
result = MessageBox.Show($"Sie brechen nun zum zweiten Mal den Indexierungsvorgang ab!{vbNewLine}Wollen Sie die Indexierung aller Dateien abbrechen?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
Else
|
||||
result = MessageBox.Show("You abort the indexdialog for the 2nd time!" & vbNewLine & "Do You want to abort indexing?", "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
result = MessageBox.Show($"You abort the indexdialog for the 2nd time!{vbNewLine}Do You want to abort indexing?", "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
End If
|
||||
|
||||
If result = MsgBoxResult.Yes Then
|
||||
Dim containsfw_file As Boolean = False
|
||||
Try
|
||||
ABORT_INDEXING = True
|
||||
Dim sql As String = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')"
|
||||
Dim sql As String = $"SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('{Environment.UserName}')"
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql, True)
|
||||
|
||||
Dim anz = DT.Rows.Count
|
||||
@@ -2225,7 +2235,7 @@ Public Class frmIndex
|
||||
|
||||
Return utf8Encoding.GetString(encodedString)
|
||||
End Function
|
||||
Private Function WORK_FILE()
|
||||
Private Function WORK_FILE() As Boolean
|
||||
Try
|
||||
Me.VWDDINDEX_MANTableAdapter.Fill(Me.MyDataset.VWDDINDEX_MAN, CURRENT_DOKART_ID)
|
||||
_Logger.Debug("Manuelle Indexe geladen")
|
||||
@@ -2751,6 +2761,8 @@ Public Class frmIndex
|
||||
End If
|
||||
End If
|
||||
|
||||
EMAIL.Clear_TempFiles()
|
||||
|
||||
DocumentViewer1.CloseDocument()
|
||||
DocumentViewer1.Done()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user