#include "fivewin.ch"
#define olFolderContacts 10
ANNOUNCE RDDSYS
FUNCTION MAIN( cNomeFile )
LOCAL oOutlook := CREATEOBJECT( "Outlook.Application" )
LOCAL oNameSpace := oOutlook:GetNameSpace("MAPI")
LOCAL oContacts := oNameSpace:GetDefaultFolder( olFolderContacts )
LOCAL i
LOCAL aStruct := {}
AADD( aStruct , { "NOME" , "C" , 50 , 0 } )
AADD( aStruct , { "INDI" , "C" , 50 , 0 } )
AADD( aStruct , { "CAP" , "C" , 5 , 0 } )
AADD( aStruct , { "CITTA" , "C" , 50 , 0 } )
AADD( aStruct , { "STATO" , "C" , 50 , 0 } )
AADD( aStruct , { "STATO2" , "C" , 50 , 0 } )
AADD( aStruct , { "TELEFONO" , "C" , 50 , 0 } )
AADD( aStruct , { "EMAIL" , "C" , 50 , 0 } )
AADD( aStruct , { "NOTE" , "M" , 10 , 0 } )
DbCreate( cNomeFile , aStruct, "DBFCDX" )
SET DATE BRITISH
USE &cNomeFIle
FOR i = 1 TO oContacts:Items:Count
APPEND BLANK
REPLACE field->nome WITH oContacts:Items[ i ]:FullName
REPLACE field->indi WITH oContacts:Items[ i ]:BusinessAddressStreet
REPLACE field->cap WITH oContacts:Items[ i ]:BusinessAddressPostalCode
REPLACE field->citta WITH oContacts:Items[ i ]:BusinessAddressCity
REPLACE field->stato WITH oContacts:Items[ i ]:BusinessAddressState
REPLACE field->stato2 WITH oContacts:Items[ i ]:BusinessAddressCountry
REPLACE field->telefono WITH oContacts:Items[ i ]:BusinessTelephoneNumber
REPLACE field->email WITH oContacts:Items[ i ]:Email1Address
REPLACE field->note WITH oContacts:Items[ i ]:Body
NEXT
oOutlook:Quit()
RETURN NIL
INIT PROCEDURE RddInit
REQUEST DBFFPT
REQUEST DBFCDX