Manage Learn to apply best practices and optimize your operations.

Rename a database with Lotus Script API

This Lotus Script code calls an undocumented function "NSFDbRename" in the nnotes.dll.

This Lotus Script code calls an undocumented function "NSFDbRename" in the nnotes.dll. Works successfully in Notes 4.6. Not tested in R5.

It accepts two parameters:
1. Database to be renamed (with optional server)
2. New database name (with optional server)

If you specify a server, it must be in the format:


In this case, both parameters MUST contain the canonical server name.

This function also uses the "OSLoadString" API call to convert an API error code into a string value.

If you need to use the same function written in "C", let me know and I will send you the C code.

Dennis Fry

Option Public
Option Explicit

Declare Function W32_NSFDbRename Lib "nnotes.dll" Alias "NSFDbRename" (Byval DbCurrent As String, Byval DbNew As String) As Integer
Declare Function W32_OSLoadString Lib "nnotes.dll" Alias "OSLoadString" (Byval hModule As Long, Byval StringCode As Integer, Byval retBuffer As String, Byval BufferLength As Integer) As Integer

Sub Initialize
     Dim iret As Integer
     Dim szError As String * 256
     Dim ErrorString As String
     Dim StrLen As Integer
'rename a database on SERVER/OU from "mail\mailfile.nsf" to "mail\mailfilenew.nsf"

     iret = W32_NSFDbRename("SERVER/OU!!mail\mailfile.nsf", "SERVER/OU!!mail\mailfilenew.nsf")
     If iret <> 0 Then
          ErrorString = ""
          szError = String$(256, 0)
          StrLen = W32_OSLoadString(0, iret, szError, 255)
          If Strlen <> 0 Then ErrorString = Left$(szError, StrLen)
          Print "Error " & iret & " (" & ErrorString & ")"
     End If
End Sub

Dig Deeper on Lotus Notes Domino Administration Tools



  • 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 ...