Retreiving all attachments

I have a doc created on the web using multiple attachments (file upload control).an agent reads these docs to retrieve associated attachments.

I only gets the first $file fields. what do i have to do ?

I am using notesEmbeddedObject = doc.GetAttachment to gets attachments.

I’ve tried to read first $file and then remove it to get the next but once i remove the item, it remove all subsequent $file fields.

Thanks for your help

Subject: retreiving all attachments -

Processing all attachments should work well if you do it as lined out in designer help.

If the problem is because the attachments are not in the richtextfield due to web file upload, then use

Forall o In doc.EmbeddedObjects

'…

End Forall

instead of the “rtitem.EmbeddedObjects”

hope that helps,

with best regards,

Florian

p.s. beware, the script may need some error handling in case that embeddedobjects is nothing or similar …

=========================

'may not need the (doc)dim stuff

Dim doc as NotesDocument

Dim rtitem As Variant

'…set value of doc…

'may need to adjust the name of the richtextfield that holds the attachment(s)

Set rtitem = doc.GetFirstItem( “Body” )

If ( rtitem.Type = RICHTEXT ) Then

Forall o In rtitem.EmbeddedObjects

If ( o.Type = EMBED_ATTACHMENT ) Then



  'Do what you need here

  

End If

End Forall

End If

=========================

Subject: RE: retreiving all attachments -

I should use doc.EmbeddedObjects because doc are created via the web using file upload.nevertheless I’ve tried both method and get error messages.

First method I’ve “Type mismatch”, and accessing the rich text field (in my case $File because) i get "instance memeber EmbeddedOjects does notr exists.

Wghen I debug, $File’s type is 1084 whiwh is Fileattachment …

I don’t what’s wrong in my code…

Florian if you have any idea

Thanks

Subject: RE: retreiving all attachments -

Hi Jules,

tested it in a teamroom forum which also uses a normal web upload control and that works fine with getting the attachments from the “Body” field, even though attachments are not uploaded to there.

give the following source a try (may need to adapt the uidoc/doc initialization and print statement - i just wrote it to test it in the notes client as an ui agent).

you should NOT use “$File” as the richtext filename!

with best regards,

  • Florian

    Dim uiw As New notesuiworkspace

    Dim uidoc As notesuidocument

    Set uidoc=uiw.currentdocument

    Dim doc As NotesDocument

    Set doc=uidoc.document

    Dim rtitem As Variant

    Set rtitem = doc.GetFirstItem( “Body” )

    If ( rtitem.Type = RICHTEXT ) Then

      Forall o In rtitem.EmbeddedObjects
    
      	If ( o.Type = EMBED_ATTACHMENT ) Then
    
      		
    
      		Print o.source
    
      		
    
      	End If
    
      End Forall
    

    End If

Subject: RE: retreiving all attachments -

I’ve tried, and found same pb as before. It seems when multiple $file fields are in the doc, that only the first can be retrieve.

I have found a way around. better to screen all items and then to determine if they have attchments.

Many thanks for your help