Stef Merlijn
asked on
Update Outlook contact from within Delphi
Hi,
Currently I use following code to find a contact in Outlook:
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;
Is there a quicker way to do this?
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...
So I do confirm, that you are definitely on the right way with your solution...
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for your answers.
Accessing Outlook Contacts