Contacts in custom adress books not recognized as OlAddressEntryUserType.olOutlookContactAddressEntry

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

Contacts in custom adress books not recognized as OlAddressEntryUserType.olOutlookContactAddressEntry
 
Niels Ziegler


Guest


I need to identify the type of a recipient in ItemSend event. I am using a switch construct for every recipient like this:

switch (recipient.AddressEntry.AddressEntryUserType)
{
case OLInterop.OlAddressEntryUserType.olExchangeUserAddressEntry:
break;
case OLInterop.OlAddressEntryUserType.olOutlookContactAddressEntry:
HandleOutlookContact(nonValidRecipients, ldapHelper, recipient);
break;
case OLInterop.OlAddressEntryUserType.olSmtpAddressEntry:
HandleNewContact(nonValidRecipients, ldapHelper, recipient.AddressEntry);
break;
}

When I get an "olSmtpAddressEntry" I create a new entry in a custom adressbook (HandleNewContact), because I need to add certificates to it. But the next time I try to send an email to this recipient, it is not recognized as an "olOutlookContactAddressEntry". This seems to work only in the default adressbook.
Is there something I can do differently, or do I need to check the custom adressbook for existing entries myself every time?

I am creating the contact like this:

contact = customAB.Items.Add(OLInterop.OlItemType.olContactItem) as OLInterop.ContactItem;
contact.Email1Address = recipient.Address;
contact.Save();
Posted 16 Jun, 2017 04:34:19 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hello Niels,

Your code contains unreleased COM objects. To check if they relate to the issue, try to restart Outlook.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Jun, 2017 06:18:41 Top
Niels Ziegler


Guest


I did not post all of the code, and I was releasing objects.

But maybe something did get locked up, because when I re-tried it now, it worked.
Posted 19 Jun, 2017 05:53:03 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
Hello Niels,

Restarting Outlook releases COM objects among other things.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Jun, 2017 07:05:42 Top
Niels Ziegler


Guest


I need to reopen this question. I had to implement some other features, but coming back to this I realized, Outlook will not search my custom adress book to find contacts. I can create and search contacts, but when Outlook tries to "resolve" an e-mail adress inserted into the recipients box, it will only find it inside the default adressbook.

I did this to get certificates from a mail gateway applicance on the network. But when I add the certificate to the contact in my custom adress book, Outlook will not find and therefore not use this contact.

Do you have any advice how to change this behaviour, except putting those contacts into the default adressbook?
Posted 10 Jul, 2017 07:24:39 Top
Niels Ziegler


Guest


I need to reopen this question. I had to implement some other features, but coming back to this I realized, Outlook will not search my custom adress book to find contacts. I can create and search contacts, but when Outlook tries to "resolve" an e-mail adress enter into the recipients box, it will only find it inside the default adressbook.

I did this to get certificates from a mail gateway applicance on the network. But when I add the certificate to the contact in my custom adress book, Outlook will not find and therefore not use this contact.

Do you have any advice how to change this behaviour, except putting those contacts into the default adressbook?
Posted 10 Jul, 2017 09:28:37 Top
Niels Ziegler


Guest


Sorry, I realized afterwards, setting ShowAsOutlookAB changes the behaviour. I even had this before, but it was commented out a while ago.
Posted 10 Jul, 2017 09:30:10 Top
Andrei Smolin


Add-in Express team


Posts: 18823
Joined: 2006-05-11
No problem.


Andrei Smolin
Add-in Express Team Leader
Posted 10 Jul, 2017 10:03:29 Top