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.
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?
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.
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.