in reply to Outlook MailItem Body Question

I know nothing about Outlook, and very little about OLE, but you read a value from an attribute

my $body = $items->Item($itemIndex)->Body;

modify it and then write it back to a hash element?

$items->Item($itemIndex)->{'Body'} = $body;

Which just doesn't seem right to me. It's a pure guess, but you might try

$items->Item($itemIndex)->Body = $body;

Assuming the Body attribute is writable through Win32::OLE, and I see no reason it shouldn't be, then that might give you the result you're after.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!

Replies are listed 'Best First'.
Re: Re: Outlook MailItem Body Question
by Anonymous Monk on Jan 06, 2004 at 19:19 UTC
    I attempted that, but when it's written as you suggested, I get an error reading: "Can't modify non-lvalue subroutine call at ..." The method I came up with I found elsewhere on the web. Not sure if it's right, though. : )

      If Body is a subroutine, then the syntax for setting the value back would (probably) be

      $items->Item($itemIndex)->Body( $body );

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Hooray!

        Yeah, that's not it either... Body is an attribute, not a method, unfortunately.

        Straight from the VBA Outlook documentation:

        Body (Property).
        Returns or sets the clear-text body of the mail message or post. Read/write String.