WAIT WINDOW NOWAIT "Starting up Outlook Email program" ol=createobject("outlook.application") ons=ol.getnamespace("MAPI") * create table if necessary * crea table bibmail (date D, mailtext M, processed L) * set references to public folders oAllPub=ons.folders("Public Folders").folders("All Public Folders") oMain=oAllPub.folders("Admin Tasks").folders("Bibliofind") oArchive=oAllPub.folders("Admin Tasks").folders("Bibliofind Archive") * for default inbox, you could use: * oInbox=ons.getdefaultfolder(6) lncount=oMain.items.count FOR lnLoop = 1 TO lnCount WAIT WINDOW NOWAIT "Processing Email Message # "+ ; ALLTRIM(STR(lnLoop))+ " of "+ALLTRIM(STR(lnCount)) * reference this message oItem=oMain.items(1) * store contents, if subject is what we want IF ALLTRIM(oItem.Subject)=="Bibliofind want match" INSERT INTO bibmail ; VALUES ( DATE(), oItem.body, .f. ) ENDIF oItem.move(oArchive) ENDFOR ons.Logoff * some of these might not be necessary, but I didn't * test for what happens to the other references when * "ons" and "ol" are killed oArchive=NULL oMain=NULL oAllPub=NULL oItem=NULL ons=NULL ol=NULL WAIT CLEAR