Search code examples
c#outlookaddin-express

How to programmatically set appointment's recipient display name in Outlook without creating a contact in address book


I am trying to achieve setting programmatically the display name of an appointment's recipient in Outlook without creating a contact for him. The desired result would be the following:

which can be achieved through Outlook UI by double clicking on the respective address in Address book dialog and setting the display name in the following dialog:

enter image description here

Using the following code, adds the new recipient to the Outlook appointment but does not set the required display name:

var appointmentItem = outlookApplication.ActiveInspector() as AppointmentItem;
var newRecipient = appointmentItem.Recipients.Add("[email protected]");
newRecipient.AddressEntry.Name = "John Smith";

Any ideas how this can be achieved?


Solution

  • Pass the name in the form "John Smith <[email protected]>".