Hello,
I add all emails from contact to message by:
For Each VCardEmail In VCardContact.Emails
MapiMessage.Recipients.Add(VCardEmail.EmailAddress, VCardEmail.EmailAddress, MapiRecipientType.MAPI_TO)
Next
Kindly advise how to prevent adding duplicate emails to the MapiMessage.Recipients collection?
This is my function:
For Each MyEmail As MapiRecipient In MapiRecipientCollection
Dim MyRecipient As String = String.Empty
If String.IsNullOrWhiteSpace(MyEmail.EmailAddress) = False Then
MyRecipient = MyEmail.EmailAddress
ElseIf String.IsNullOrWhiteSpace(MyEmail.OrganizationEmailAddress) = False Then
MyRecipient = MyEmail.OrganizationEmailAddress
End If
If MyRecipient = InputEmail Then Return True
First I didn’t know MapiRecipient can contain how many email address fields, so found and compared against EmailAddress and OrganizationEmailAddress
Second was not sure if there’s a method/property to check existence or duplicate preventing?