A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
PrimarySmtpAddress is empty for Exchange Recipient in Outlook
Hi,
I am developing Outlook VSTO application, and encountered issue with retrieving email address from Outlook Recipients.
I have followed the guidelines from the links below
- https://learn.microsoft.com/en-us/office/client-developer/outlook/pia/how-to-get-the-e-mail-address-of-a-recipient
- https://social.msdn.microsoft.com/Forums/Lync/en-US/2b64e44c-0bc0-4e86-abf8-c91a6040608f/property-not-present-outlook-2016-office-365-vs-outlook-2013?forum=outlookdev
- https://social.msdn.microsoft.com/Forums/office/en-US/6a919ff0-6200-4818-80e5-4ad9dfbc7dd9/failsafe-way-of-getting-smtp-addresses-of-all-email-recipients?forum=outlookdev
- https://social.microsoft.com/Forums/windows/zh-CN/58135a22-039e-43af-b611-7f2a04821b14/the-property-quothttpschemasmicrosoftcommapiproptag0x39fe001equot-is-unknown-or-cannot?forum=outlookdev
Then I have this logic to get email address from a Recipient based on the recommendations from above links
if (addressEntry.Type == "EX")
{
smtpAddress = addressEntry.GetExchangeUser().PrimarySmtpAddress;
}
else
{
smtpAddress = addressEntry.Address.ToLowerInvariant();
}
The issue happens in a condition in which the recipient type is "EX", but the PrimarySmtpAddress does not have value. Even further, in that case I also checked that the PR_SMTP_ADDRESS is also missing. Also, the property AddressEntry.Name only returns a Full Name, not an email address. So what should I do in that case to get the correct email address?
Your help would be much appreciated.
Thank you
Exchange Online
Microsoft 365 and Office | Development | Other
Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
Outlook | Windows | Classic Outlook for Windows | For business
Using classic Outlook for Windows in business environments