FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Retrieve items from contact folders in Outlook
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Retrieve items from contact folders in Outlook
Posted: Mon Sep 21, 2009 11:52 AM

Hi,
I have to rewrite this program in order to retrieve all fields from all contact folders.
Actually this sample program show me only a few fields from default contact folder.
I have to questions:
1) How can I obtain an Array that contains a list of all contact folders?
2) Ho can I ontain an Array containing all field in a contact

In this way I am able to nest tree for next

FOR iFolder := 1 TO oFolder:count
FOR iContact := 1 TO oContact:count
FOR iField := 1 TO oField:count
? FolderName, ContactName, ContactPhone, ContactEmail, etc, etc,
NEXT iField

   NEXT iContact

NEXT iFolder

Thanks In advance

marco

include "fivewin.ch"

define olFolderContacts 10

FUNCTION MAIN()

LOCAL oOutlook := CREATEOBJECT( "Outlook.Application" )
LOCAL oNameSpace := oOutlook:GetNameSpace("MAPI")
LOCAL oContacts := oNameSpace:GetDefaultFolder( olFolderContacts )

LOCAL i

SET DATE BRITISH

FOR i = 1 TO oContacts:Items:Count
    ? oContacts:Items[ i ]:FullName                              , ;
      oContacts:Items[ i ]:BusinessAddressStreet          , ;
      oContacts:Items[ i ]:BusinessAddressPostalCode   , ;
      oContacts:Items[ i ]:BusinessAddressCity             , ;
      oContacts:Items[ i ]:BusinessAddressState           , ;
      oContacts:Items[ i ]:BusinessAddressCountry        , ;
      oContacts:Items[ i ]:BusinessTelephoneNumber    , ;
      oContacts:Items[ i ]:Email1Address                      , ;
      oContacts:Items[ i ]:LastModificationTime           , ;
      oContacts:Items[ i ]:Categories
NEXT

oOutlook:Quit()

RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Retrieve items from contact folders in Outlook
Posted: Tue Sep 22, 2009 02:47 PM

Hi everybody,
the problem has been solved in another way.

Thanks to all
marco

Marco Boschi
info@marcoboschi.it
Posts: 284
Joined: Mon Oct 24, 2005 08:04 PM
Re: Retrieve items from contact folders in Outlook
Posted: Tue Sep 22, 2009 04:41 PM

Marco,

Can you tell us how you solved this problem?

Thanks,
Randal

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Retrieve items from contact folders in Outlook
Posted: Wed Sep 23, 2009 07:05 AM

Excuse me,
I meant to say: the problem of extracting the data, not write a program to extract them.
I copy every folder into contact folder and use this program
When I have time I will study this problem.

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
rddSetDefault( "DBFCDX" )

Marco Boschi
info@marcoboschi.it
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Retrieve items from contact folders in Outlook
Posted: Wed Sep 23, 2009 07:16 AM
Hello Marco,
I would be more interested in how you solved this problem:
Code (fw): Select all Collapse
When I have time


Best regards,
Otto :-)
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Retrieve items from contact folders in Outlook
Posted: Wed Sep 23, 2009 07:59 AM

Otto,

when I have time I will go in Austria to swim, to fish, to walk, to sky...to live!

8)

Marco Boschi
info@marcoboschi.it

Continue the discussion