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

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close