Improve error message for outlook error

This commit is contained in:
Jonathan Jenne 2021-04-07 16:28:44 +02:00
parent 37e61b91f0
commit 645ca1b893

View File

@ -120,22 +120,24 @@ Public Class ClassFileDrop
'Sonderzeichen entfernen
subj = ClassFilehandle.InvalidCharacters(subj)
'hardcode a destination path for testing
Dim strFile As String = IO.Path.Combine(Path.GetTempPath, subj + ".msg")
strFile = strFile.Replace("?", "")
strFile = strFile.Replace("!", "")
strFile = strFile.Replace("%", "")
strFile = strFile.Replace("$", "")
LOGGER.Info(">> Drop of msg - File:" & strFile)
Dim oFilename As String = IO.Path.Combine(Path.GetTempPath, subj + ".msg")
oFilename = oFilename.Replace("?", "")
oFilename = oFilename.Replace("!", "")
oFilename = oFilename.Replace("%", "")
oFilename = oFilename.Replace("$", "")
LOGGER.Info(">> Drop of msg - File:" & oFilename)
Try
myobj.SaveAs(strFile)
myobj.SaveAs(oFilename)
Catch ex As Exception
LOGGER.Error(ex)
MsgBox("Error in Save Email2Tempfile" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return False
MsgBox("Die Email konnte aufgrund einer Sicherheitseinstellung im Outlook nicht abgelegt werden! " &
"Bitte wenden Sie sich an Ihren Administrator, " &
"um den programmatischen Zugriff auf Outlook zuzulassen. " &
"Weitere Informationen finden Sie im Log.", MsgBoxStyle.Critical, "Global Indexer")
End Try
ReDim Preserve files_dropped(i)
files_dropped(i) = "|OUTLOOK_MESSAGE|" & strFile
files_dropped(i) = "|OUTLOOK_MESSAGE|" & oFilename
Next
Return True
'Drop eines Outlook Attachments