Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing messages from outlook into a VFP table?
Message
De
25/07/2000 14:40:29
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00396326
Message ID:
00396724
Vues:
15
Doug,

>I did have the outlook2000 client running at the time, and am using VFP6.0 SP4

You could try something like this:

1) start Outlook
2) get references to "Inbox" and "Archive" (a folder I set up)
3) step through inbox messages, storing message bodies (you could of course store date, from, subject, etc.)
4) move messages to Archive folder
5) close up
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
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform