Prüfung beim MailItem mittels TryCast, ob Mailobjekt nicht beschädigt ist.
This commit is contained in:
@@ -106,12 +106,21 @@ Public Class AVISO_Mail_Functions
|
||||
Dim explorer As Outlook.Explorer = Globals.ThisAddIn.Application.ActiveExplorer
|
||||
Dim selection As Outlook.Selection = explorer.Selection
|
||||
If selection.Count > 0 Then
|
||||
Dim selectedItem = selection(1)
|
||||
Dim mailItem As Outlook.MailItem = selectedItem
|
||||
mailItem = DirectCast(mailItem, Outlook.MailItem)
|
||||
Dim selectedItem As Object = selection(1)
|
||||
|
||||
addMailToAviso(mailItem, isFormular)
|
||||
Dim result = TryCast(selectedItem, Outlook.MailItem)
|
||||
|
||||
If result IsNot Nothing Then
|
||||
|
||||
Dim mailItem As Outlook.MailItem = selectedItem
|
||||
mailItem = DirectCast(mailItem, Outlook.MailItem)
|
||||
|
||||
addMailToAviso(mailItem, isFormular)
|
||||
Else
|
||||
MsgBox("Die markierte Email kann nicht verarbeitet werden!" & vbNewLine & "Bitte andere Mail verwenden.")
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user