Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to synchronize Contacts from Outlook
Message
De
02/05/2001 10:17:42
 
 
À
02/05/2001 10:06:16
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00502350
Message ID:
00502486
Vues:
15
Hi Tamar,

You could write module code in VBA in Outlook that automatically wrote to a VFP
table when a new item was created within Outlook. Or you could use VFPCOM to bind Outlook events to a VFP application to do that. Andrew Coates has an excellent article on the latter approach in the October 2000 issue of FoxTalk.

>>
>>Is there is any tool/utility availible which allows the data synchronization between Microsoft Outlook and a VFP free table.
>>
>
>I don't know of a tool (which doesn't mean that there isn't one). You can write code to do this. If you just want to do it periodically, you can use code along the lines of this example (from "Microsoft Office Automation with Visual FoxPro", which Della Martin and I wrote, www.hentzenwerke.com):
>
>This example adds a single record, chosen at random. Just set up a loop to add multiple records.
>
>* Add supplier information
>#DEFINE olContactItem 2
>#DEFINE olBusiness 2
>
>LOCAL oNameSpace, oContact
>
>IF VarType(oOutlook) <> "O"
> * Start or connect to Outlook
> * Make it public for demonstration purposes.
> RELEASE oOutlook
> PUBLIC oOutlook
> oOutlook = CreateObject("Outlook.Application")
>ENDIF
>
>oNameSpace = oOutlook.GetNameSpace("MAPI")
>
>* Open Supplier
>OPEN DATA _SAMPLES + "TasTrade\Data\TasTrade"
>USE Supplier
>
>* Pick a random record for demonstration purposes
>GO RAND()* RECCOUNT()
>
>* Create a new contact record
>oContact = oOutlook.CreateItem( olContactItem )
>
>WITH oContact
> .FullName = Contact_Name
> .CompanyName = Company_Name
> .BusinessAddressStreet = Address
> .BusinessAddressCity = City
> .BusinessAddressState = Region
> .BusinessAddressPostalCode = Postal_Code
> .BusinessAddressCountry = Country
> .SelectedMailingAddress = olBusiness
> .BusinessTelephoneNumber = Phone
> .PrimaryTelephoneNumber = Phone
> .BusinessFaxNumber = Fax
> .Save()
>ENDWITH
>
>USE
>
>RETURN
>
>The other thing you'll want to do is check whether the record is already in Contacts. Use the Find method of the Contacts.Items collection to do that, something like:
>
>oContacts = oNS.GetDefaultFolder( 9 )
>cFilter = '[CompanyName]=' + Company_Name'
>oItem = oContacts.Items.Find( cFilter )
>IF ISNULL(oItem)
> * This is a new one. Add it.
>ENDIF
>
>Tamar
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform