While db.CreateCopy in R6, does not copy the image resources

Posted on 2004-10-22
Last Modified: 2013-12-18
I have created a script to create db's but it does not copy the image Shared Ressources. Do you know how I can get these resources and copy them to the new db with script?

Question by:koray_uygun
    LVL 24

    Expert Comment

    What do you do in the script.. copy design element by element ??

    Don't you use CreateCopy method of the database ?


    Author Comment

    Set templateDB = New notesDatabase ( doc.txtTempDBServer(0) , doc.txtTempDBPath(0))
    Print "Creating New DB : " + doc.txtDBName(0)
    Set targetDB =  templateDB.CreateCopy( dbServer , dbPath)
    dbName = doc.txtDBName(0)
    LVL 14

    Accepted Solution

    Createcopy is known to fail in some cases, I use this :

    Const NOTE_CLASS_PRIVATE = 4096%
    Const NOTE_CLASS_ALL = 32767%

    Declare Function OSPathNetConstruct Lib "NNotes.dll" Alias "OSPathNetConstruct" (Byval PortName As String, Byval ServerName As String, Byval FileName As String, Byval retPathName As String) As Integer
    Declare Function OSLoadString Lib "NNotes.dll" Alias "OSLoadString" (Byval hModule As Long, Byval StringCode As Long, Byval retBuffer As String, Byval BufferLength As Integer) As Integer
    Declare Function NSFDbClose Lib "NNotes.dll" Alias "NSFDbClose" (Byval hDB As Long) As Integer
    Declare Function NSFDbCreateAndCopy Lib "NNotes.dll" Alias "NSFDbCreateAndCopy" (Byval srcDb As String, Byval dstDb As String, _
    Byval NoteClass As Integer, Byval limit As Integer, Byval flags As Long, retHandle As Long) As Integer

    Function CreateDBCopy(fromServer As String, fromDBPath As String, toServer As String, toDBPath As String, _
    noteFlags As Integer, mbSize As Integer, copyFlags As Long) As NotesDatabase

    Dim fromNetPath As String
    Dim toNetPath As String
    Dim hDb As Long
    Dim ret As Integer

    Set CreateDBCopy = Nothing

    fromNetPath = String(256,Chr(0))
    toNetPath = String(256,Chr(0))

    If OSPathNetConstruct("",fromServer, fromDBPath, fromNetPath) <> 0 Then
    Error 32000, "Could not create Network Path from " + fromServer + " & " + fromDBPath
    End If

    If OSPathNetConstruct("",toServer, toDBPath, toNetPath) <> 0 Then
    Error 32000, "Could not create Network Path to " + toServer + " & " + toDBPath
    End If

    ret = NSFDbCreateAndCopy(fromNetPath, toNetPath, _
    noteFlags, mbSize, copyFlags, hDb)

    If ret = 0 Then

    Call NSFDbClose(hDb)
    Set CreateDBCopy = New NotesDatabase(toServer, toDBPath)

    Error 32000, "Error creating database" + toDBPath + " on " + toServer + ": " + OSErrorString(ret)
    End If

    End Function

    ' In your routine...
    ' The routine will return the database if created, and will raise an error if there is a problem.
    ' If there are any private design elements, it still fails, so you need to trap for that situation.

    Set toDB = CreateDBCopy(fromDB.Server, fromDB.FilePath, baseServer.Canonical, basePath + "\" + repidToFile(Listtag(dbv)), NOTE_CLASS_ALL - NOTE_CLASS_PRIVATE, 0, 0)

    LVL 31

    Expert Comment

    I like to create replica and change the replica ID.

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
    For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles al…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    875 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

    12 Experts available now in Live!

    Get 1:1 Help Now