Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to save attached files from incoming mail in a direc
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00594686
Message ID:
00594971
Vues:
28
>Hi friends!
>
>Is there a way to save the attached files that come from incoming emails in a given directory? I'd like it to be general, speaking of email clients, if possible, if not then please, would you explain it using Outlook (not 2002, nor Express)? If I am not being clear, I'll explain it in other words: Suppose I am receiving email, then some of these messges contain attached files, at that time I would like, for example, to store the emails in a table and the attached files in a directory, and also save the path to those files in a field of the corresponding records. (Now, I think, I'm being clear ;-) )
>
>Luis


In addition to what Sergey has provided, try some code like this
LOCAL oOutlook, oNameSpace, oFolder, oMessage, oAttachment, i, j

oOutlook= CREATEOBJECT("Outlook.application")
oNameSpace= oOutlook.GetNameSpace("MAPI")
oFolder= oNameSpace.folders(1).folders("MyFolder")
FOR i = 1 TO oFolder.Items.Count
    oMessage= oFolder.Items.Item[1]
    FOR j = 1 TO oMessage.Attachments.Count
        oAttachment= oMessage.Attachments.Item[j]
        oAttachment.SaveAsFile("C:\MyFile")
    ENDFOR
    oMessage.move(oNameSpace.Folders(1).Folders("MyFinishedFolder"))
ENDFOR
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform