Einzelnen Beitrag anzeigen

Delphi-Lover

Registriert seit: 19. Okt 2004
Ort: Amsterdam
30 Beiträge
 
Delphi 2005 Professional
 
#2

Re: Outlook, resolve the smtp address from mailitem

  Alt 28. Okt 2004, 10:58
Hello,

I found a solution by opening the Outlook Global Address List (GAL) and check all the items and see if you can find that SMTP-string. If found then you can ask the GAL for the real address. I'm not going to publish the code, but you can find it on the web. like :

Outlook Addressbook

In the code he is using a try..except to check the interface type..
I think better coding is to check the interface by the queryinterface:

Delphi-Quellcode:
Check:=IUnknown(myAddressEntry.MAPIOBJECT).QueryInterface(IMailUser,MP);
If Check=0 then MP:=IUnknown(myAddressEntry.MAPIOBJECT) as IMailUser
else MP:= IUnknown(myAddressEntry.MAPIOBJECT) as IDistList;
Some of the examples (VB/Delphi/C) you can find will not work, but sometimes that's because the Delphi Server Outlook Component is adding the "Outlook8" unit in the Uses part of the source. (In Delphi 5 it does..) In this unit there are a lot of functions/procedures/properties that will be used by the example codes, but also a lot of functionality that is not in the outlook8. So, when you use this unit a lot of examples will not work. (and for some days you ask yourself why?! To solve this problem you can add another unit called "Outlook2000". A lot of examples will work with this unit. You can use them both if you like.

Uses OleServer, Outlook8, Outlook2000; Greetings,

Delphi Lover.
Rob
  Mit Zitat antworten Zitat