PrimarySmtpAddress is empty for Exchange Recipient in Outlook

Alfian Ramadhan 11 Reputation points
2022-03-24T14:13:33.417+00:00

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

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
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.

Microsoft 365 and Office | Development | Other
Outlook | Windows | Classic Outlook for Windows | For business

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.