Link to home
Start Free TrialLog in
Avatar of Stef Merlijn
Stef MerlijnFlag for Netherlands

asked on

Update Outlook contact from within Delphi

Hi,

Currently I use following code to find a contact in Outlook:
          ContactGevonden := False;
          for j := 1 to ContactenMap.Items.Count do
          begin
            Contact := ContactenMap.Items.Item(j);
            if (Contact.CustomerID = QRelatiesOutlook.FieldByName('Relatienr').AsString) then
            begin
              ContactGevonden := True;
              Break;
            end;
          end;
          if NOT ContactGevonden then
          begin
            // Aanmaken van een nieuwe contactpersoon.
            Contact := ContactenMap.Items.Add; // (olContactItem); // as ContactItem;
            Toegevoegd := Toegevoegd + 1;
          end;

Open in new window

Is there a quicker way to do this?
Avatar of Thommy
Thommy
Flag of Germany image

You can try this...
Accessing Outlook Contacts
There would hardly be any quicker solution as you already have,  to first check contact list before adding a new outlook contact.

So I do confirm, that you are definitely on the right way with your solution...
Avatar of Stef Merlijn

ASKER

Thommy, the link you posted won't work on Delphi XE2 as OfficePartner only support Delphi 7 or earlier.

I thought there might be some FIND, SEARCH or LOCATE function that could be used. So you don't have to look at each Outlook contactrecord to find it.
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much, this looks promissing. But I need be be able to use it in older versions of Office too (from Office XP and up).
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much for your answers.