Hi @Kurt Jensen ,
Please ensure that the Sender
object and its related properties (GetExchangeUser
and PrimarySmtpAddress
) are not null before accessing them.
If wrkmsg.Sender IsNot Nothing Then
Dim senderAddress As String = ""
If wrkmsg.SenderEmailType = "EX" Then
Dim exchangeUser = wrkmsg.Sender.GetExchangeUser()
If exchangeUser IsNot Nothing Then
senderAddress = exchangeUser.PrimarySmtpAddress
End If
Else
senderAddress = wrkmsg.SenderEmailAddress
End If
ListBox1.Items.Add(wrkmsg.Subject & " " & senderAddress)
End If
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.