Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing messages from outlook into a VFP table?
Message
From
27/11/2001 11:02:11
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00396326
Message ID:
00586357
Views:
52
Mike,

My usual pre-VFP7 research approach would be:

1) Check for .chm help files on your local hard drive -- vba*.chm are the way the Office VB programming help files are named

2) Search MSDN for "Outlook object model"

3) Visit the local bookstore and take a peek in books titled something like "Building Outlook Applications" or "Super-Jumbo Office 2000 Mega-Reference" or etc.

With VFP7 it starts with:

1) Use VFP7's Intellisense:
* 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 type
2) 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)

3) Don't have VFP7 yet? Get it. It's worth the price just for these features.

>Where do find a list available variables such as .body, .subject, etc.?
>
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform