Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extract eMail sender address from Outlook
Message
De
16/01/2001 17:24:26
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australie
 
 
À
16/01/2001 12:55:58
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00464284
Message ID:
00464438
Vues:
22
Hi Robert,

How about:
loOutLook     = CREATEOBJECT("Outlook.Application")
loNameSpace   = loOutLook.GetNameSpace("MAPI")
loInbox	      = loNameSpace.GetDefaultFolder(6)
nMessageCount = loInbox.Items.Count

FOR nLoop = 1 TO nMessageCount
    loReply  = loInbox.Items[nLoop].Reply
    lcSender = loReply.Recipients[1].Address
    WAIT WINDOW lcSender NOWAIT
ENDFOR
Hope this helps,
Gavin...

>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform