I have stumbled upon a nontrivial use case for automatically handling items in Outlook VBA based on the Sender Email. This is when the item was sent "on behalf of".
Issue description
Use Case 1
In Microsoft Outlook, if you get a Google calendar invitation, it will be sent by calendar-notification@google.com on behalf of the real organizer (see screenshot below)
Also if you get a meeting forwarded it will be sent on behalf of the organizer.
Outlook VBA Sent of behalf of
https://stackoverflow.com/questions/57355562/capturing-actual-on-behalf-of-email-id-from-outlook-mail-instead-of-the-sender-i
OutlookMail.Sender.Address - will give the OnBehalfOf Email but it works only for Emails - not for Meetings.
Solution
The trick for getting the email of the real organizer is to use the ReplyRecipients property.
More precisely the organizer email will match .ReplyRecipients.Item(1).Address
You can see an example of how I have used it, for example, in my macro to automatically mark appointment coming from my Google calendar as private.
Or for the macro I use to categorize based on the recipients/sender email addresses.
No comments:
Post a Comment