Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to save attached files from incoming mail in a direc
Message
 
To
14/12/2001 17:26:31
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00594686
Message ID:
00594971
Views:
25
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform