Copying and Pasting a Picture

Posted on 2005-04-06
Last Modified: 2013-12-18
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.
Question by:Faraj1969
    LVL 31

    Accepted 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" =
    Dim picture as notesRuchTextItem
    set picture = employee.getFirstItem("PictureField")
    call copied.copyItem(picture, "Name of new picture field") true,true

    Author Comment

    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

    Author Comment

    Ummm.. sorry mate.... not sure what happened, but when I deleted all the records and extracted fresh records, it worked. so thank you....

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
    IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now