Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Outlook creates an OLE error
Message
 
 
À
22/12/2003 18:13:56
Michael Ouellette
Australian Technical Services (VIC) Pty
Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00861182
Message ID:
00861456
Vues:
17
Michael,

Try to get reference to the item first and prefix call to the move methos with '='.
loItem = THISFORM.oMail.oInbox.Items[(CountUnreadItems+1)-X ]
=loItem.move("CompletedMailBox")
BTW, < pre > and < /pre > tags (w/o spaces) preserve code formatting and make it easier to read.

>This is the basics:
>* get Inbox name
>thisform.oInbox=THIS.GetMailObject("MyInboxMailbox")
>
>procedure getmailobject
>LPARAMETERS lcRequiredFolder
>
>* Create the necessary objects to get to the message
>THIS.oApplication=CREATEOBJECT("Outlook.Application")
>THIS.oNameSpace=THIS.oApplication.GetNameSpace("MAPI")
>RETURN THIS.GetFolder(lcRequiredFolder)
>
>Procedure getfolder
>Lparameters lcRequiredFolder
>
>Local lnFolderNumber, ;
>    lnLoop, ;
>    lcFolderName,;
>    lcFolderNameIn
>
>mexit=.F.
>
>lnFolderNumber=0
>
>For ii=1 to this.oNameSpace.Folders.Count
>
>With THIS.oNameSpace.Folders[ii]
>    lcFolderName= .name
>    If LOWER(lcFolderName)=LOWER(lcRequiredFolder)
>     For lnLoop=1 TO .Folders.Count
>            lcFolderNameIn=.Folders[lnLoop].Name
>      If LOWER(lcFolderNameIn)= "inbox"
>        lnFolderNumber=lnLoop
>         mexit=.T.
>        Exit
>      Endif
>     Endfor
>    Endif  LOWER(lcFolderName)=LOWER(lcRequiredFolder)
>
>Endwith
>if mexit=.T.
> exit
>endif
>Endfor
>
> If lnFolderNumber>0
> Return THIS.oNameSpace.Folders[ii].Folders[lnFolderNumber]
> Else
> Return NULL
> Endif
>
>The above all works fine
>* find "Completed" folder under this mailbox
>If !isnull(THISFORM.oMail.oInbox)
> For y=1 to THISFORM.oMail.oInbox.folders.count
> If lower(THISFORM.oMail.oInbox.folders[y].name)="completed"
>   CompletedMailBox=THISFORM.oMail.oInbox.folders[y]
>   Exit
> Endif
> Endfor
>* so far so good
>
>CountUnreadItems=THISFORM.oMail.oInbox.Items.Count && works
>for x=1 to CountUnreadItems
>* CRASHES HERE ON MOVE
>  THISFORM.oMail.oInbox.Items[(CountUnreadItems+1)-X ].move("CompletedMailBox")  
  && move from oldest to newest in case new mail comes in
>endfor
>That's it!
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform