Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" _
( Byval dbName As String, hdb As Long ) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" _
( Byval hdb As Long ) As Integer
Declare Function W32_NSFDbInfoGet Lib "nnotes.dll" Alias "NSFDbInfoGet" _
(Byval hdb As Long, Byval dbInfo As String ) As Integer
Declare Sub W32_NSFDbInfoModify Lib "nnotes.dll" Alias "NSFDbInfoModify" _
(Byval dbInfo As String, Byval what As Long, Byval newValue As String )
Declare Function W32_NSFDbInfoSet Lib "nnotes.dll" Alias "NSFDbInfoSet" _
(Byval hdb As Long, Byval dbInfo As String ) As Integer
Declare Function W32_DesignRefresh Lib "nnotes.dll" Alias "DesignRefresh" _
(Byval sourceServer As String, Byval hDb As Long, Byval dwFlags As Long, _
Byval null0 As Long, Byval null1 As Long) As Integer
And a function to call the replace design:
Function designReplace( strTargetServer As String, _
strTargetFile As String, strTemplateName As String, _
strSourceServer As String, refreshNow As Integer) As Integer
'strTargetServer is the server where the database to get new desig resides
'strTargetFile is the database
'strSourceServer is the server where the design is refreshed from
'refreshNow = True, starts refresh right away, otherwise youll have to wait
'for the server or do it manually.
designReplace = False
Dim Sdb As String
Dim Tdb As String
Dim hdb As Long
Dim strDbInfo As String * 255
Dim strDBtitle As String * 255
Dim strDBtemplate As String * 255
Dim rc As Integer
Dim Force As Integer
'*** Build the path for target databases.
If strTargetServer = "" Then
Tdb$ = strTargetFile
Else
Tdb$ = strTargetServer & "!!" & strTargetFile
End If
'*** Get the db info from target database
rc% = W32_NSFDbOpen( Tdb$, hdb& )
If rc% <> 0 Then
'Error opening target database
Exit Function
End If
rc% = W32_NSFDbInfoGet( hdb&;, strDbInfo )
If rc% <> 0 Then
'Error retrieving database info
Exit Function
End If
Call W32_NSFDbInfoModify( strDbInfo, 3, strTemplateName )
rc% = W32_NSFDbInfoSet( hdb&, strDbInfo )
If rc% <> 0 Then
'Error setting new design info
Exit Function
End If
If refreshNow Then
'Initiate refresh immediately...
rc% = W32_DesignRefresh( strSourceServer, hdb&, 0, 0, 0 )
End If
rc% = W32_NSFDbClose( hdb& )
designReplace = True
End Function