Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: sfx dunoo
  
 
 
 sfx dunoo
 Tags
Subject: outlook automation and mailitem.current
Thread ID: 33687 Message ID: 33687 # Views: 3 # Ratings: 0
Version: Visual FoxPro 6 Category: Microsoft Office Automation
Date: Monday, December 01, 2003 10:48:25 PM         
   


Hello,

I have found this sample program with which it is possible to save all attachments that are contained within all messages.
I have been searching for a program with which it would be possible to save the attachments from ONE or MORE selected message only, but NOT ALL.

Can anyone help me ?

many thanks in advance,


Sven
#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).item
&&myAtts=olNameSpace.GetDefaultFolder(olFolderInbox).items()

&&(OlApp.ActiveInspector().CurrentItem as MailItem).Subject 

messagebox("aantal mails = " + str(olNameSpace.GetDefaultFolder(olFolderInbox).items.count))

&&myAtts=olNameSpace.GetDefaultFolder(olFolderInbox).items()

locurrwindow= ooutlookobject.activeexplorer
messagebox(loCurrWindow.CurrentFolder.Name)
locurrwindow.activeExplorer.CurrentFolder = olNameSpace.GetDefaultFolder(olFolderInbox)

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.Delete() && The option to delete the message once the attachment has been saved.
        Next
    Endif
Next


ENTIRE THREAD

outlook automation and mailitem.current Posted by sfx dunoo @ 12/1/2003 10:48:25 PM
RE: outlook automation and mailitem.current Posted by Yuri Rubinov @ 12/2/2003 2:51:23 PM
RE: outlook automation and mailitem.current Posted by sfx dunoo @ 12/3/2003 12:36:14 AM
RE: outlook automation and mailitem.current Posted by Yuri Rubinov @ 12/3/2003 2:56:54 PM
RE: outlook automation and mailitem.current Posted by sfx dunoo @ 12/3/2003 5:38:50 PM
RE: outlook automation and mailitem.current Posted by Yuri Rubinov @ 12/3/2003 9:25:15 PM
RE: outlook automation and mailitem.current Posted by sfx dunoo @ 12/4/2003 12:30:41 AM
RE: outlook automation and mailitem.current Posted by Yuri Rubinov @ 12/4/2003 3:22:11 PM
RE: outlook automation and mailitem.current Posted by sfx dunoo @ 12/5/2003 12:36:46 AM