outlook: Recipients and resolving.. Can it be forced to take email and name as provided ?

Add-in Express™ Support Service
That's what is more important than anything else

outlook: Recipients and resolving.. Can it be forced to take email and name as provided ?
 
Tim Smet




Posts: 37
Joined: 2015-10-06
Hi,

I have a small question regarding resolvment of recipients. What we have been doing for a long time is something similar to do this code for adding recipients:


Recip := mailitem.recpients.add('FamiliehulpVZW <test@test.com>');
Recip.Type_ := olTo;
Recip.Resolve;


This works all fine and dandy and will display "FamiliehulpVZW <test@test.com>" with email address Test@test.com attached to it after the resolve statement. However we have now noticed a problem. If someone in their outlook has a contact person with the name "FamiliehulpVZW" with a different email address for example (zorro@zorro.com) saved in their address book. Calling recip.resolve will switch the recipient to the contact found in the address book with the diffrent email address and people won't actually notice this as it just displays "FamiliehulpVZW" in the to edit box

This somewhat how the outlook resolving (matching against contacts against address book works). But i like to know if there is a way so that it will always use 'FamiliehulpVZW <test@test.com>' as displayname and 'test@test.com' as email address of the recipient even if there exists a contact item named 'FamiliehulpVZW' with a different email attached to it.

Basically i'm asking if there is a way to either force not looking up in the address book or to force outlook to use our provided name + email somehow without outlook changing it afterwards to something else it has found a match for in any addressbook ?

Since i can not immediatly find a way, but maybe i'm missing something what i do now after calling recip.resolve is i check if the email provided in recip.addressentry.address matches our provided email and if not i delete the recipient and only add the email address as recipient. in our example above i basically repeat the code but call with Recip := mailitem.recpients.add('test@test.com') then it does not match it against an entry in the address book or if it does it will change the name to the name from the address book but the email address will remain the same. But the downside is we loose the name part in the display in this case as i had only provided an email address (if no contact item with that email address exists). With the problem i described above initially the email could have changed to that of the person with same name saved in the address book after calling resolve.

So basically i like to have a way so that it uses our supplied display name + email without outlook changing it afterwards. Not calling recip.resolve, is not really a solution as the client can still resolve manually and when sending i noticed outlook resolved it anyway but not sure how or under which conditions (maybe because we access some properties from the recipient in the outlook send event).

So how should this correctly be handled ?
Posted 24 Sep, 2018 05:15:59 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Tim,

Sorry for the delayed response; I overlooked your message somehow.

At https://social.msdn.microsoft.com/Forums/en-US/61670e2d-33f9-4c6e-a309-dbdf5d6123d0/createrecipient-gets-wrong-recipient?forum=outlookdev, Ken Slovak wrote:

That's typical of Exchange recipient resolution if there aren't distinct and unique names. Try using the actual SMTP address equivalents for the desired recipients instead of using a name. That will work.


You may also want to check if Redemption is of help in your scenario; see what Dmitry Streblechenko wrote on that page.


Andrei Smolin
Add-in Express Team Leader
Posted 03 Oct, 2018 06:17:17 Top