Page 1 of 1

Export to outlook contacts

PostPosted: Tue Apr 10, 2007 3:37 pm
by Marc Vanzegbroeck
Hello,

Is there a posibility to export the email-adresses that are now in a FW-database to outlook contacts?

Thanks
Marc

Re: Export to outlook contacts

PostPosted: Tue Apr 10, 2007 5:25 pm
by Enrico Maria Giordano
Code: Select all  Expand view
#define olContactItem 2


FUNCTION MAIN()

    LOCAL oOutlook := CREATEOBJECT( "Outlook.Application" )

    LOCAL oContact := oOutlook:CreateItem( olContactItem )

    oContact:FullName = "This is a new contact"
    oContact:Email1Address = "newcontact@newmail.it"

    oContact:Save()

    oOutlook:Quit()

    RETURN NIL


EMG

PostPosted: Wed Apr 11, 2007 5:12 am
by Marc Vanzegbroeck
Thanks Enrico,

Is there also a possibility to check if a contact already exist? My customer is adding contacts in my program and want to update every month the contacts in outlook.

Thanks,
Marc

PostPosted: Wed Apr 11, 2007 6:59 am
by Enrico Maria Giordano
Code: Select all  Expand view
#define olFolderContacts 10


FUNCTION MAIN()

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

    LOCAL i

    FOR i = 1 TO oContacts:Items:Count
        IF oContacts:Items[ i ]:FullName = "MyContact"
            ? "Found!"
            EXIT
        ENDIF
    NEXT

    oOutlook:Quit()

    RETURN NIL


EMG