Spiros Nikolopoulos
Guest
|
Hi,
Is it possible to find outlook address book details for a given email address (with delphi xe2)?
I have and email selected in outlook explorer and I want detail from address book (if any) Address,phone etc?
Thanks |
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Hi Spiros,
I understand you so that you need to get contact detauils for a recipietn (or sender) of an email selected in Outlook. I suppose that the following link provides the main part of the solution: http://outlook-buzz.com/outlook-contacts/AddressEntry-object-vs-Contact-object/0/article/0/34170
That is, you get Recipient.AddressEntry and then use the approach suggested by Ken Slovak to get the EntryId of the contact. To get the corresponding ContactItem, you use Namespace.GetEntryFromId().
Is this what you are looking for?
Andrei Smolin
Add-in Express Team Leader |
|
Spiros Nikolopoulos
Guest
|
Hi Andrei,
I manage to do it using Eugene's example for restrict http://www.add-in-express.com/creating-addins-blog/2011/10/21/outlook-retrieve-contact-items/
ns := self.OutlookAppObj.GetNamespace('MAPI');
iFolder := ns.GetDefaultFolder( Outlook2000.olFolderContacts );
folderItems := ifolder.Items;
resultItems := folderItems.Restrict('[Email1Address] = "<email-to-find>"');
counter :=0;mitem:=Nil;
for i:=1 to resultItems.Count do
begin
mitem := resultItems.Item(i);
try
contact := Outlook2000._ContactItem(mitem);
inc(counter);
except
mitem := Nil;
end;
mitem := Nil
end;
|
|
Andrei Smolin
Add-in Express team
Posts: 19138
Joined: 2006-05-11
|
Many thanks for posting this!
Andrei Smolin
Add-in Express Team Leader |
|