Undelete a contact in outlook
- by Alister
I have an application written in Delphi that adds / updates contacts in outlook. The problem I'm having is that if the contact has been deleted in Outlook, the code still finds the contact and updates it - and the contact still remains deleted. Is there a way I can determine if the contact is deleted or undelete the contact?
Roughly the code looks something like:
OutlookApp := CreateOleObject('Outlook.Application');
Mapi := OutlookApp.GetNameSpace('MAPI');
//.....
try
if ContactOutlookEntryID.AsString <> '' then
aContact := Mapi.GetItemFromID(ContactOutlookEntryID.AsString);
except
end;
//try to locate the contact if they have been synchro'd before
if VarIsEmpty(aContact) then //if not found
aContact := Contacts.Items.Add(2); //add a new contact to outlook
aContact.LastName := ContactSurname.AsString;
//.....