Q

Extracting and reattaching attachments

My problem is like the one in this Ask the Expert question, but a bit different. In many documents I have more than one attachment and I don't necessarily know the names in advance. My project is to extract these attachments, save them and reattach them in another field. Can you help me solve my problem?
You can find out the name of the attachments using standard functions of Domino. Using @Functions, you can use the function @AttachmentNames, which will give you a list of attachment names for the attachments in the current document.

I have added a LotusScript example below, which will guide you in the proper direction. Using the EmbeddedObjects property of the Notes document or Rich Text item, you get a list of embedded objects in your document (i.e., attachments). Then, by using the GetAttachment method, you get a handle to an attachment, which is stored in the class type of NotesEmbeddedObject. This class has properties such as Remove, ExtractFile etc.

Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim object As NotesEmbeddedObject
Set db = New NotesDatabase
( "server", "db" )
Set view = db.GetView( "viewname" )
Set doc = view.GetLastDocument
Forall o In doc.EmbeddedObjects
  Set object = doc.GetAttachment( o )
Call notesEmbeddedObject.ExtractFile
( "path to save file to" )
Call notesEmbeddedObject.Remove
End Forall

This was last published in October 2003

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close