This sample shows you how to link an Outlook/Exchange folder to a Jet Database
FUNCTION Start()
LOCAL dbeng AS DaoDBEngine
LOCAL oDB AS DaoDatabase
LOCAL oTable AS Daotable
LOCAL oTD AS DaoTableDef
LOCAL cConn AS STRING
LOCAL oSrv AS DaoServer
dbEng := DaoDbEngine{}
// open the database
oDB := dbEng:OpenDatabase("D:\Vo2Jet\Northwind.mdb",FALSE,NIL,NIL)
// delete tabledef if it is already there
// from a previous test
IF AScan(oDb:TableDefs:AsArray(),;
{|oTd|Upper(oTd:Name) == Upper("OutLookTest")}) > 0
oDb:TableDefs:Delete("OutlookTest")
ENDIF
// create tabledef to hold outlook connection
oTD := oDB:CreateTableDef("OutlookTest",NIL,NIL,NIL)
// Set connect string:
// Set the profile to your profile name
// Set the Mapilevel to the parent folder of the folder you want
// to read, in this case the "Personal folders" folder
// Set the Database name to the name of the MDB file that
// holds the linked table
cConn := "Exchange 4.0;MAPILEVEL=Personal Folders|;TableType=0;Database=" + ;
oDB:Name + ";PROFILE=Microsoft Outlook;PWD=;"
// Assign connect string to Tabledef
oTd:connect := cConn
// sourcetable is the Inbox folder below Personal Folders
oTD:SourceTableName := "Inbox"
oDB:TableDefs:Append(oTD)
// Display table properties
AEval(oTd:Propertylist(),{|aProp|QOut(aProp[1]+": ", aProp[2])})
wait
// Open Server and read outlook messages
oSrv := DaoServer{"Select * from OutLookTest"}
// display messages
? PadR("Date",19),"From", "To", "Subject"
DO WHILE ! oSrv:EoF
? oSrv:FIELDGET("Creation Time"), oSrv:FIELDGET(#From), ;
oSrv:FIELDGET("To"), oSrv:FIELDGET(#Subject)
oSrv:Skip(1)
ENDDO
oSrv:Close()
wait