我有一个用Delphi编写的应用程序,用于在outlook中添加/更新联系人.我遇到的问题是,如果在Outlook中删除了联系人,代码仍会找到联系人并对其进行更新 – 并且联系人仍然会被删除.有没有办法可以确定联系人是否被删除或取消删除联系人?
大致代码看起来像:
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; //.....