Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extract eMail sender address from Outlook
Message
De
16/01/2001 12:55:58
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Extract eMail sender address from Outlook
Divers
Thread ID:
00464284
Message ID:
00464284
Vues:
69
How can I extract the eMail sender address from Outlook via Automation? It seems that Outlook provides a sender name, if the sender of the mail item is contained in the address collection. I fiddled around with an CDO approach, but due to lacking knowledge I managed to crash VFP by executing the code below - though it delivers the desired result before going down.

Any ideas?

TIA Robert Stralka
#define OUTL_FOLDER_INBOX 6


LOCAL loOutl,loNS,loInbox,loMapiSession,i


loOutl        = CREATEOBJECT('Outlook.Application')
loNS          = loOutl.GetNameSpace('MAPI')
loInbox       = loNS.GetDefaultFolder(OUTL_FOLDER_INBOX)
loMapiSession = CREATEOBJECT('MAPI.Session')
loMapiSession.Logon(,,.F.,.F.)
FOR i = 1 TO loInbox.Items.Count
  ? getEmailAddress(loMapiSession,loInbox.Items(i))
ENDFOR
loMapiSession.Logoff()
loMapiSession = .NULL.
loInbox       = .NULL.
loNS          = .NULL.
loOutl        = .NULL.


FUNCTION getEmailAddress
  LPARAMETERS voMapiSession,voItem
  LOCAL loCDOItem,lcSenderEmailAddress

  WITH voItem
    loCDOItem = voMapiSession.GetMessage(.EntryID,.Parent.StoreID)
  ENDWITH
  lcSenderEmailAddress = loCDOItem.Sender.Address
  loCDOItem            = .NULL.
RETURN lcSenderEmailAddress
I've acquired quite a taste for a well-made mistake... [Fiona Apple]
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform