Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save email attachments send to specific email adress ?
Message
From
28/02/2008 08:22:23
Albert Beermann
Piepenbrock Service Gmbh & Cokg
Osnabrück, Germany
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Save email attachments send to specific email adress ?
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MySQL
Miscellaneous
Thread ID:
01297331
Message ID:
01297331
Views:
78
Hello Everybody
Outlook automation amateur !!!


Our exchange server receives files via email attachments.
E_mail adress for example is : service@ourcompany.net
These emails have an attachment xyznnnn.qas and are stored into the entry folder "posteingang"

Now i want to write a little vfp 9.0 programm that run on a server/worstation an checks the posteingang folder of the service account (every five minutes) and saves the attachments into a specific folder: \\server\servicetasks\ for example.

I found this example:
#DEFINE olFolderInBox 6

Local lcFilename,lcPath
lcPath='c:\savedattachments\'
If  !Directory('c:\savedAttachments')
    Md 'c:\savedAttachments' && Create the directory if it doesn't exist.
Endif
oOutLookObject = Createobject('Outlook.Application')
olNameSpace = oOutLookObject.GetNameSpace('MAPI')
myAtts=olNameSpace.GetDefaultFolder(olFolderInbox).Items
For Each loItem In myAtts
     If loItem.attachments.Count >0 && Make sure there is an actual attachment.
        For i = 1 To loItem.attachments.Count
            lcFilename=''
            lcFilename = loItem.attachments.Item(i).filename
            lcFilename = Alltrim(lcPath)+lcFilename
            loItem.attachments.Item(i).SaveAsFile(lcFilename)
	   		*loItem.attachments(i).delete()
        Next
    Endif
Next
I don't know how to use this code to scan the inbox of service@ourcompany.net
(amateur as i said)
Any help welcomed
Best regards
Albert
Next
Reply
Map
View

Click here to load this message in the networking platform