Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Outlook automation problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01234996
Message ID:
01235158
Vues:
27
Peter - i cant comment on the 'switch to app' error, but when adding contacts to Outlook, i store a fox PK value in a rarely used outlook contact field and then search on that before adding. I'd be a bit wary about searching on just a name especially with 4k+ contacts.

>I am trying to send contact info to Outlook
>the following program imports about 200 or so out ot 4000+ and ten hangs with
>the 'Swich to application' ole error dialog box...
>What am I doing wrong?
>
>NB: My outlook 2007 also craps out just about every time I use it.
>I uninstalled office 2007 and reinstlled it under Vista Ultimate
>
>ALso is there a way to check if a certain fullname already exists in outlook prior to adding it?
>
>
>
>LOCAL oAddr AS Outlook.MAPIFolder
>LOCAL oContact AS OBJECT
>
>SELECT * FROM DATA\contacts WHERE SOURCE="WH" AND NOT inOutlook ;
>	INTO CURSOR cc1 ORDER BY FULLNAME
>
>
>
>oOutlook=CREATEOBJECT("OUTLOOK.APPLICATION")
>oNameSpace=oOutlook.GetNameSpace('MAPI')
>
>llOut2VFP= .F.
>llVFP2Out= .T.
>
>
>
>
>SET STEP ON
>
>IF llVFP2Out
>	SELECT cc1
>	CNT=0
>	SCAN && cc1 (cursor)
>			CNT = CNT + 1
>			oContact=oOutlook.CreateItem(2)
>			WITH oContact
>				WAIT WINDOW TIMEOUT 1  TRANSFORM(cnt)+": "+cc1.FULLNAME
>				.FULLNAME 				= cc1.FULLNAME
>				.LastName 				= cc1.lname
>				.FirstName 				= cc1.fname-(" "+cc1.mname)
>				.Birthday 				= cc1.bday
>				.HomeAddress 			= cc1.hfullAddress
>				.HomeAddressCity 		= cc1.hCity
>				.HomeAddressState 		= cc1.hState
>				.HomeAddressPostalCode	= cc1.hZip
>				.HomeTelephoneNumber 	= cc1.hPhone
>				.HomeFaxNumber 			= cc1.hFax
>				.CarTelephoneNumber 	= cc1.hCell
>				.Email1Address			= cc1.email
>				.SAVE()
>				UPDATE contacts set inOutlook = .T. WHERE contact_id=cc1.contact_id
>
>			ENDWITH
>			oContact=NULL
>
>	ENDSCAN
>
>ENDIF
>?"Done"
>
>
>
>
>
>thanks
>
>
>peter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform