Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird Problem with Outlook and VFP 7
Message
De
11/07/2002 08:37:39
Lloyd Grant
Meridian Legal Systems
Buxton, Royaume Uni
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Weird Problem with Outlook and VFP 7
Divers
Thread ID:
00677475
Message ID:
00677475
Vues:
68
I am running VFP 7 with Service Pack 1 and Outlook 2000 SR-1 (9.0.0.3821). Sometimes when I try to delete a contact in Outlook I get the message "parameter is not optional". If I step through the code then it works and deletes the contact. This behavior makes it very difficult to trace the problem. Below is the code currently. This code worked fine in VFP6.

Anyone got any ideas?

*-- Delete contact if found
IF ISNULL( loOneContact )
lnResult = NOT_FOUND_BY_OUTLOOK && Not found in Outlook
ELSE
*-- Start 13/06/2002
*-- Lloyd Grant
*-- I found that the contact was not deleted if I didn't include
*-- this WAIT WINDOW. I messed about with AutoYield and that didn't
*-- make any difference. If I traced through the code via the debugger
*-- it worked OK. I can't explain this, but the WAIT WINDOW
*-- fixes it so the contact is deleted. Very strange :/
*-- Start 02/07/2002
*-- Lloyd Grant
*-- This still does not fix it, so some code has been added to
*-- try again with some delay etc to try it a second time...

*-- Lloyd Grant
*-- End 13/06/2002

THIS.lStopOnError = .F.
THIS.lErrorOccured = .F. && Reset any error condition
loOneContact.Delete()
llSuccess = NOT THIS.lErrorOccured
THIS.lStopOnError = llStopOnError
*-- Start 02/07/2002
*-- Lloyd Grant
*-- Weird problem, somedays we can delete the contact, others we can not.
*-- Issue a sleep and see if that helps...
IF llSuccess
loOneContact = NULL
ELSE
loOneContact = NULL
THIS.lErrorOccured = .F. && Reset any error condition
loOneContact = THIS.FindContact( lcOutlookProperty, lcPropertyValue )
llSuccess = NOT THIS.lErrorOccured
*-- Another vague attempt to fix the problem, invert the autoyield
_VFP.AutoYield = NOT _VFP.AutoYield
*-- Tell VFP to do anything that is floating around
DOEVENTS
*-- Now wait a while
DECLARE Sleep IN win32api INTEGER
Sleep( 100 )
WAIT WINDOW "" NOWAIT
THIS.lErrorOccured = .F. && Reset any error condition
THIS.lStopOnError = .F.
loOneContact.Delete()
llSuccess = NOT THIS.lErrorOccured
THIS.lStopOnError = llStopOnError
IF llSuccess
loOneContact = NULL
ENDIF
ENDIF
*-- Lloyd Grant
*-- End 02/07/2002

*!* loOneContact = NULL

IF llSuccess
lnResult = CONTACT_DELETED && Found and deleted
ELSE
lnResult = CONTACT_FAILED_TO_DELETE
ENDIF
ENDIF
ELSE
lnResult = FIND_FAILED_TO_RUN
ENDIF
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform