Trouble with EmbeddedObjects

Hi there,we have an agent in a mail-DB which worked fine since over a year (LD7). After we updated to LD8, it doesn’t. The agent waits for new mails with a specific subject and detaches the attachment to disk. Here’s the code:

If doc.HasEmbedded Then

  Dim rtitem As NotesRichTextItem

  Set rtitem = doc.GetFirstItem( "Body" )

      

  Dim rtArr As Variant

  rtArr = rtitem.EmbeddedObjects

  

  Dim docArr As Variant

  docArr = doc.EmbeddedObjects

  

  If Isempty(rtArr) Then

    Print "rtArr is empty!"        

    Forall o In docArr      

      If ( o.Type = EMBED_ATTACHMENT ) Then            

        Call o.ExtractFile( "f:\notes\data\Omniture\" & o.Name)   

      End If

    End Forall        

  Else        

    If ( rtitem.Type = RICHTEXT ) Then

      Forall o In rtArr      

        If ( o.Type = EMBED_ATTACHMENT ) Then              

          Call o.ExtractFile( "f:\notes\data\Omniture\" & o.Name)    

        End If

      End Forall

    End If

 end if

  doc.Subject = doc.Subject(0) & "#" & Cstr(Now())    

  Call doc.save(False, False)

End If

What I get is a “Type mismatch” at “Forall o In docArr” (followed by some “FOR loop not initialized”) which propably means that there aren’t embedded objects in the notesdocument either. But in this case th every first IF should end the script…?

Plus: when I launch the agente manually, it works.

Plusplus: after the agent has run, the attachment is only 4byte long :frowning:

Very strange - any ideas about that?

Thanks,

Buzzy

Subject: Use IsArray instead of IsEmpty

I just ran into the exact same problem.

By checking if it is an array instead of Isempty, you should not recieve a “Type Mismatch” error when calling rtitem.EmbeddedObjects.

Subject: I have the same issue…

Any code sample to check for an array ?

Subject: Addon…

…works only when manually launched from a LD7-client - not with LD8!!!