Body field is not accessable to LotusScript

Hi all,

we have a button in our mail file that is used to copy the content of the body field from an incoming email to a rich text field in another database. Every so often it fails, and I can’t figure out why.

The line causing the problem is:

Call newdoc.CopyItem( xDoc.GetFirstItem(“Body”), “InteractionDescr”)

For the problem email, the error I get is ‘Function requires a valid ADT argument’, and if I look at the document with debugger, I cannot see any item called Body, which is why GetFirstItem is returning the error. But when I look at the document properties via the property box, there are several instances of the Body field.

Could anyone throw any light on this and suggest a way round it?

TIA

Tony

Subject: Body field is not accessable to LotusScript

I’m sure you’ve done this but just for certainty’s sake, put the xDoc.GetFirstItem(“Body”) outside the call to copyItem.

For instance,

if Not (xDoc is nothing) then

if xDoc.HasItem(“Body”) then

 set bodyItem = xDoc.GetFirstItem("Body")

 if Not (bodyItem is nothing) then

    'Try one of these

    Set newBodyItem = bodyItem.CopyItemToDocument( newdoc, "InteractionDescr" )



    call newdoc.CopyItem(bodyItem, "InteractionDescr")

 end if

else

  print "no body item found"

end if

else

  print "lost doc handle"

end if

If that doesn’t work, or provide you with more information as to exactly which variable is giving you the problem, please respond back.

Just making sure the Body item is the one really giving you the problem and that xDoc or newDoc is not hosed for some reason.

Worth a shot.

Jason

Subject: RE: Body field is not accessable to LotusScript

Hi Jason,

thanks for your input. Have tried seperating it out to be 100% sure as you suggested - and it is most definitely not getting a handle on the Body field - the rtitem does not get set and there is no item called Body showing when I debug it. Yet when I perform the same operation on another document, it works fine.

I’m going to try re-saving it and see if that helps.

Tony

Subject: Body field is not accessable to LotusScript

Might be worth a try to take a look at the .name property of all the elements in the NotesDocument.EmbeddedObjects array.

Examine the $FILE field to see if there’s a difference between the ones that work and the ones that do not.

Jason