developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




how to check for rtitem has embeddedObjects but object has no objects
Don R Green 07/13/2007 12:12 PM
Notes Client 6.0.2 CF2 Windows 2000


I have an agent that extracts embedded objects from the Body text of a document. It came accross a document that does not have an EMBEDDEDOBJECTS array and threw the error:

Instance member EMBEDDEDOBJECTS does not exist

I've tried several things to no avail.

Because there is no EmbeddedObjects array, the line
"If Isarray (rtitem.EmbeddedObjects) Then" fails.
How can I verify that an array exist in the item?

Please check the code below and recommend how I can check for an array.

'----------------------------------------------------
If docMain.HasItem("Body") Then
'get the Subject item of the main document
Set itemBody = docMain.GetFirstItem("Body")

'now check for ebmedded objects in the Body text of ritem
Set rtitem = docMain.GetFirstItem( "Body" )

If Isarray (rtitem.EmbeddedObjects) Then
'get "Instance member EMBEDDEDOBJECTS does not exist"
Forall o In rtitem.EmbeddedObjects
If Not (o Is Nothing) Then
If ( o.Type = EMBED_ATTACHMENT ) Then
AttachmentName = o.Name
....blah blah blah
Call o.ExtractFile _
(FolderName & Cstr(DocCntr) & "_" & FromStr & "_" & "ATTCHMNT" & "_" & AttachmentName)
End If
End If
End Forall

Else
Print #outputFile, "Attachment: Not an object array. "
End If
Print #outputFile, itemBody.Text
Else
Print #outputFile, "*** NO BODY TEXT IN EMAIL ***"
End If
'----------------------------------------------------


I've tried the following to check for EmbeddedObjects:

'If ( rtitem.Type = RICHTEXT ) Or ( rtitem.Type = TEXT ) And docMain.HasEmbedded And Not(Isempty(rtitem.EmbeddedObjects)) Then
'If rtitem.hasitem("EmbeddedObjects") Then 'no such luck
'If (rtitem.EmbeddedObjects) Then
'If Not Isempty(rtitem.EmbeddedObjects) Then
'If Not (rtitem.EmbeddedObjects) Is Nothing Then
'If Isarray (rtitem.EmbeddedObjects) Then
'get "Instance member EMBEDDEDOBJECTS does not exist"
'when doc does not have EMBEDDEDOBJECTS
'If docMain.HasEmbedded Then
'get "Instance member EMBEDDEDOBJECTS does not exist"


Thanks for your help!

Go back