PRB: "Parameter Not Optional" Error Message When You Use Move Method in Outlook 2000 (316988)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 7.0
  • Microsoft Visual FoxPro for Windows 7.0 SP1

This article was previously published under Q316988

SYMPTOMS

If you are automating Microsoft Outlook 2000 from Visual FoxPro 7.0, when you call the Move method of a folder item, you may receive the following error message:
OLE error code 0x8002000f: Parameter not optional.

RESOLUTION

To resolve this problem in Visual FoxPro 7.0, use one of the following methods:
  • Preface the Move method call with an equal sign (=) character. For example:
    =loFldr1.items(i).Move(loFldr2)
    					
  • Upgrade to Microsoft Outlook 2002.
NOTE: This problem can occur with methods other than the item Move method. Apply the equal sign resolution in those scenarios to resolve the problem.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Run the following code from a program (.prg) file in Visual FoxPro 7.0 or Visual FoxPro 7.0 Service Pack 1 (SP1):
    #DEFINE olFolderDrafts    16
    #DEFINE olFolderInbox      6
    loApp = CREATEOBJECT("Outlook.Application")
    loSpace = loApp.GetNameSpace("MAPI")
    loFldr1 = loSpace.GetDefaultFolder(olFolderInbox)
    loFldr2 = loSpace.GetDefaultFolder(olFolderDrafts)
    *!* Try to move 3 messages into the Drafts folder 
    FOR i = 1 to 3
       *!* Following line fails with the message:
       *!* Program Error - OLE error code 0x8002000f: Parameter Not Optional
       loFldr1.items(i).Move(loFldr2) && Move to "Drafts" folder
    ENDFOR
    RETURN
    					
  2. This program moves three messages from your Outlook Inbox to your Drafts folder. When the program has completed, move the messages back manually.

    Notice that you receive the error message that is listed in the "Symptoms" section. This error occurs on the loFldr1.items(i).Move(loFldr2) line.
  3. To resolve this problem, preface the call to the Move method with an equal sign (=):
    =loFldr1.items(i).Move(loFldr2)
    					

Modification Type:MajorLast Reviewed:5/14/2002
Keywords:kbCodeSnippet kbDSupport kbprb KB316988