Undelete a contact in outlook

Posted by Alister on Stack Overflow See other posts from Stack Overflow or by Alister
Published on 2010-03-07T23:28:51Z Indexed on 2010/03/07 23:53 UTC
Read the original article Hit count: 214

Filed under:
|
|

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;
//.....

© Stack Overflow or respective owner

Related posts about delphi

Related posts about outlook