Manage Learn to apply best practices and optimize your operations.

Upload images into selected documents

This tip shows you how to import multiple images into a set of selected documents from a folder.

This tip shows you how to import multiple images into a set of selected documents from a folder.

Write the code given below in an agent and call the agent. In this example the image whose file name is the same as that of the name field in the document is imported. The name field can be changed to any field in the document.

Sub Initialize
 Dim workspace As New NotesUIWorkspace
 Dim uidoc As NotesUIDocument
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim collection As NotesDocumentCollection
 Dim nme As Variant
 Dim doc As NotesDocument    
 Dim view As NotesUIView 
 Dim view1 As notesview
 Dim m As Integer
 Set db = session.CurrentDatabase
 Set view = workspace.CurrentView
 Set view1 = db.GetView( view.viewname )
 Set collection = db.UnprocessedDocuments
 If Isempty(Filename1) Then Exit Sub
 actfilename=Strleftback( Filename1(0),"")
 Set doc = collection.GetFirstDocument
 While Not Doc Is Nothing
  nme = doc.Name(0)
  filename =actfilename  &"" & nme &".jpg"
  Set uidoc = workspace.
EditDocument( True, doc ) ' 
  Call uidoc.GotoField("Picture")
  Call uidoc.Import("JPEG Image", filename)
  Call uidoc.Save
  Call uidoc.Close
  Set doc = collection.
getnextdocument (doc)
 End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Pamela. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on LotusScript



  • iSeries tutorials'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 ...