in reply to moving emails between folders with Win32::OLE

If I remember correctly, you need two objects in your hand: one for the message, and another object for the target-folder.
Then there must be a method for the message called $messageObject->MoveTo($targetFolderObject).

But I'll look it up tonight and post its exact name and usaege (it was about in 1998 when I've last worked with perl and Outlook/Exchange via Win32::OLE (MAPI/CDO)).

Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

  • Comment on Re: moving emails between folders with Win32::OLE

Replies are listed 'Best First'.
Re: Re: moving emails between folders with Win32::OLE
by RayRay459 (Pilgrim) on May 14, 2002 at 15:36 UTC
    Thanks for the advice. Very Much appreciated. I attempted to use this line and got an error:
    $item->MoveTo($Folder5);
    C:\scripts\perl\email>getsearchemail.pl Attributes caty3 Update ok SEARCH: roadster active-desc2 Indexing Results ok Win32::OLE(0.1501) error 0x80020006: "Unknown name" in GetIDsOfNames of "MoveTo" at C:\scripts\perl\email\getSearchEm +ail.pl lin e 28
    Did i understand what you said correctly?
      Sorry, was my error. MoveTo requires the FolderID or StoreID as String. http://msdn.microsoft.com/ -> search for CDO and MoveTo says about the following:
      $item->MoveTo( $Folder5->{FolderID} );
      or:
      $item->MoveTo( $Folder5->{StoreID} );

      Best regards,
      perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

        I'm having a problem identifying the store id.. I found this link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_moveto_method_folder_object_.asp and even with this :
        $item->{MoveTo}( $Folder5 ); i get this error Win32::OLE(0.1501) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "MoveTo" at C:\scripts\perl\email\getSearchE +mail.pl li ne 27 with this line: $item->MoveTo( $Folder5); i get Win32::OLE(0.1501) error 0x80020006: "Unknown name" in GetIDsOfNames of "MoveTo" at C:\scripts\perl\email\getSearchEm +ail.pl lin e 27
        still can't seem to find the right line to make the current item in my loop move to another folder. Anything else i can try? Thnx, Ray
        I'm having trouble figuring out what the storeid is. i looked at the page http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_folder_object.asp
        and i can't seem to get a grip on how that would work in my code. I must be missing something in this line that makes it think that it doesn't have the right number of parameters. i'm getting errors that say :
        Win32::OLE(0.1501) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "MoveTo" at C:\scripts\perl\email\getSearchE +mail.pl li ne 27
        with the line :
        $item->{MoveTo}( $Folder5 );
        <banging head against my desk> i wish i could make this work. Can anyone help? Thanks again Strat for your postings. I do appreciate your help. Ray