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