Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bad Help Needed!!
Message
From
13/05/2002 08:03:23
 
 
To
13/05/2002 04:11:08
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00655574
Message ID:
00655600
Views:
22
>Hi Everyone.... time to kick the ol' cow again - OUTLOOK automation... right, I have done a lot of study on this; checked a lot of FAQ, articles, and printed heaps of threads on the subject. So, I thought I would write my own little program... and it works... except for one small thing: moving A message from the inbox to the deleted items folder; notice I said 'A' message...
>
>So, here is what I have:
>
>
>*-- A single message deleter
>LPARAMETERS lnCurrentMessage, lcMessageSubject
>
>lnReturn = -1
>loInbox = THIS.oOutInbox  && The default Inbox folder - already defined
>loDeletedItems = THIS.oOutDeleted  && The default Deleted Items folder - already defined
>lnWork = 0
>FOR EACH loMsg IN loInbox.Items
>     lnWork = lnWork+1
>     lcWorkSubject = THIS.GetInSubject(lnWork)
>     IF lnWork = lnCurrentMessageNo .AND. LOWER(lnWorkSubject)=LOWER(lcMessageSubject)
>          *-- Right, by reckoning, this should move the message I am on....
>          *-- ERROR SPOT!!!! Remember this spot!!! The error occurs here!!!
>          loMsg.Move( loDeletedItems )
>          lnReturn = 0
>          *-- Okay, remember, I only want ONE message deleted, this one... so we can go now...
>          EXIT
>     ENDIF
>ENDFOR
>*--- Do all the cleanup stuff....
>*-- Return a '0' - we did good, Return -1, no message deleted
>RETURN lnReturn
>
>
>Right, well this is what I get at the 'ERROR SPOT'
>
>
>    OLE error code 0x8002000f: Parameter Not Optional
>
>
>
>I can only jump from a bridge from here... lol... does anyone have a clue here? I have tried to reverse the count, etc... to no avail...

A SWAG - the deletion changes the count - try using a FOR...NEXT loop with a decrementing count from (loInBox.Count - 1) TO 0 STEP -1; collections in most cases are zero-indexed. Also, do not make the reference (loInBox.Count - 1), instead, save the value to a local variable, as reevaluation of the expression would change the counter.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform