Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating Outlooks Contact List
Message
From
08/09/2000 17:06:32
 
 
To
08/09/2000 16:40:54
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00414409
Message ID:
00414438
Views:
15
>Is there a way I can update Outlook's 2000 contact information with data that's in my vfp 6.0 tables?

Yes, you can do this with Automation. Here's an example from the book that Della Martin and I wrote about automating Office. It picks a random record from the TasTrade Supplier table and creates a corresponding contact in Outlook.

* MakeContact.PRG
* © 2000, Tamar E. Granor and Della Martin
* From: Microsoft Office Automation with Visual FoxPro
* Hentzenwerke Publishing. www.hentzenwerke.com

* 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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform