* in program editor: LOCAL oOutlook AS Outlook.Application oOutlook = CREATEOBJECT("Outlook.Application") oOutlook. && Intellisense shows you the entire object model as you type * or, in the command window: oOutlook = CREATEOBJECT("Outlook.Application") oOutlook. && Intellisense shows you the entire object model as you type2) Use the VFP7 Object Browser, which can show you not just properties, but also values of constants often used in code samples (like msoOrientationHorizontal, etc)
WAIT WINDOW NOWAIT "Starting up Outlook Email program" >>ol=createobject("outlook.application") >>ons=ol.getnamespace("MAPI") >>crea cursor mymail (mailtext M) >>oMain=ons.folders("Personal Folders").folders("Inbox") >>oArchive=ons.folders("Personal Folders").folders("Archive") >>lncount=oMain.items.count >> >>* in case you like to see what the counts are >>wait window "Inbox contains "+ALLTRIM(STR(lncount))+" messages." >>wait window "Saved folder contains "+ ; >> ALLTRIM(STR(oArchive.items.count))+" messages." >> >>* NOTE: This processes messages from oldest date to newest >>FOR lnLoop = 1 TO lnCount >> WAIT WINDOW NOWAIT "Processing Email Message # "+ALLTRIM(STR(lnLoop))+; >> " of "+ALLTRIM(STR(lnCount)) >> INSERT INTO mymail (mailtext) ; >> VALUES (oMain.items(lnLoop).body) >>ENDFOR >> >>FOR lnLoop = 1 TO lnCount >> WAIT WINDOW NOWAIT "Archiving Email Message # "+ALLTRIM(STR(lnLoop))+; >> " of "+ALLTRIM(STR(lnCount)) >> * must refer always to items(1) because after >> * moving each message to archive, the next >> * message shifts to #1 >> oItem=oMain.items(1) >> oItem.move(oArchive) >>ENDFOR >> >>ons.Logoff >>ons=.NULL. >>ol=.NULL. >>WAIT CLEAR >>USE