FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Update the contacts in Microsoft Outlook
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Update the contacts in Microsoft Outlook
Posted: Wed Jun 15, 2011 05:32 PM

Hi all,
I need to export my customers data into the contacts folder in Outlook. As I know it can be made via OLE.
Do you have a working sample to make this ?

Thanks in advance.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Update the contacts in Microsoft Outlook
Posted: Thu Jun 16, 2011 05:48 AM
Try This,

Code (fw): Select all Collapse
#include "fivewin.ch"
#DEFINE olFolderContacts 10

//----------------------------------------------------------------------------//
Function Main()

    LOCAL oOutlook,oNameSpace,oDefaultFolder,oContact
    oOutlook:= CREATEOBJECT('outlook.application')
    oNameSpace:= oOutlook:getnamespace('MAPI')
    oDefaultFolder:=oNameSpace:GetDefaultFolder(olFolderContacts) // Contacts
    
    oContact = oOutlook:CreateItem(2) // oContactItem

    With object oContact
        :FirstName = "Anser First Name"
        :LastName = "Anser Last Name"
        :Email1Address = "anserkk@xdsss.com"
        :CompanyName = "My Test Company"
        :BusinessTelephoneNumber = "9689987890000"
        :BusinessFaxNumber = "123456789"
        :HomeTelephoneNumber = "987654321"
    End
    
    oContact:Close(0) // Save
    oDefaultFolder:display()
   
Return nil


Regards
Anser

Continue the discussion