Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to synchronize Contacts from Outlook
Message
De
02/05/2001 10:06:16
 
 
À
02/05/2001 02:14:16
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00502350
Message ID:
00502468
Vues:
23
>Hi All,
>
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform