• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Copying and Pasting a Picture

Hi everyone,

I'm extracting data from one Database to another with an automatic agent that keeps checking for any update. 1st Database called MainDb, and the second called SubDb. Now in MainDb, each staff record have a picture of the employee, and its not an attachment. How can I copy that picture from MainDb document and paste it in SubDb document thro Lotus Script ?

Many thanks in advance.
  • 2
1 Solution
The picture is part of a rich text field.  You just have to copy the rich text field that contains the picture. However, you will also be copying the entire content of that rich text field, which may contain more than just the picture.


Dim source as new notesDatabase ( server , "maindb" )
Dim target as new notesDatabase ( server , "subdb" )
Dim view as notesView
Set view = source.getView("Employees")
dim employee as notesDocument
Set employee = view.getFirstDocument
Dim copied as new notesDocument(target)
copied.form = "Sub db emp form"
copied.name = employee.name
Dim picture as notesRuchTextItem
set picture = employee.getFirstItem("PictureField")
call copied.copyItem(picture, "Name of new picture field")
copied.save true,true
Faraj1969Author Commented:
Hey qwaletee, sub mate ?

Sorry to say it didn't work, both fields are RightTextItem. Here's a piece of the code, maybe it would help.

                Dim Session       As New NotesSession
      Dim dbMON       As NotesDatabase
      Dim dbFPMS       As NotesDatabase
      Dim vwMON       As NotesView
      Dim vwFPMS       As NotesView
      Dim docMON       As NotesDocument
      Dim docFPMS       As NotesDocument
      Dim Lx            As Integer
      Dim Sx            As Integer
      Dim LxPic            As NotesRichTextItem
      On Error Goto ErrorHandler
      Set dbMON      = Session.CurrentDatabase
      Set dbFPMS      = New NotesDatabase( tpFPMSServer, tpFPMSName )
      Set vwMON      = dbMON.GetView("All\Staff Members")
      Set vwFPMS      = dbFPMS.GetView("SMP\By Index_No")
      Set docMON      = vwMON.GetFirstDocument
      Set docFPMS      = vwFPMS.GetFirstDocument
      Lx = 0
      While Not ( docFPMS Is Nothing )
            Set docMON      = vwMON.GetDocumentByKey( docFPMS.Index_No(0), True )
            If docMON Is Nothing Then
                  Set docMON      = New NotesDocument( dbMON )
                  docMON.Form      = "Staff Record"
                  docMON.tCheck_In      = "No"
                  docMON.tSMID      = Cstr( docFPMS.UniversalID )
                  docMON.tSRID      = Cstr( docMON.UniversalID )
            End If
            docMON.tStatus            = docFPMS.Status
            docMON.nArrange            = 0
            docMON.tIndex_No            = docFPMS.Index_No
            docMON.tCon            = docFPMS.Category
            Set LxPic                                      = docFPMS.GetFirstItem( "StaffPhoto" )
            Call docMON.CopyItem( LxPic, "tSPicture")
            docMON.tHonorific            = docFPMS.Title

Cheers mate
Faraj1969Author Commented:
Ummm.. sorry mate.... not sure what happened, but when I deleted all the records and extracted fresh records, it worked. so thank you....
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now