finding a certain contact in constant time

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

finding a certain contact in constant time
 
Guest


Guest


Hi,

Is there a way to check to see if a contact with a given email address (or contact name) exists in a given folder, without iterating in the folder and comparing the contact with every single contact item?

Brute force approach takes too much time if there are 1000+ contacts in a contact folder.

Aim is to check for duplicate contact before adding created contact.

Thanks in advance,
Serhat.
Posted 22 Dec, 2005 07:37:34 Top
Donald


Guest


Hi Serhat,

Have you find using the find or Restrict to do this??

http://support.microsoft.com/?kbid=201081

Donald
Posted 22 Dec, 2005 07:45:48 Top
Brad Smith




Posts: 49
Joined: 2005-11-22
I've done this in C++, but I haven't yet ported the code to C#. You use the Find method against your contacts collection to return the first match, and FindNext to return subsequent matches..
If you want a collection of all matching contacts, then use the Restrict method.

In your MSDN Library look up "Items Object" and review the Find & Restrict method documentation. The articles include examples on how to build up the search string. Take note that there are three email address properties per contact ("[Email1Address]", "[Email2Address]" and "[Email3Address]"), so you need to build up your search accordingly.

Brad.
Posted 22 Dec, 2005 07:55:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7225
Joined: 2004-07-05
Hi Serhat.

You can use the approach proposed by Donald but as far as I know it works properly if you use Exchange Server as a storage.
Posted 22 Dec, 2005 08:00:27 Top
Guest


Guest


Thank you all, find method works smooth.

Sergey, I am not using Exchange Server, and it is working properly, but the target computer will be using Exchange Server.

I hope you did not mean "..it works properly if you don't use Exchange Server.."

Did you?

Thanks again.
Posted 24 Dec, 2005 06:35:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7225
Joined: 2004-07-05
Hi Serhat.

Yes. I think it should work fine with Exchange. In my case I tried to apply a filter to custom field. Probably it could be a problem.
Posted 24 Dec, 2005 09:16:04 Top