Declarations:
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
Function designReplace( strTargetServer As String, strTargetFile As String,_
strSourceServer As String, strTemplateName As String)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
MsgBox "Fehler " & rc
'Error setting new design info
Exit Function
End If
rc% = W32_DesignRefresh( strSourceServer, hdb&, 0, 0, 0 )
If rc% <> 0 Then MsgBox "Fehler " & rc
rc% = W32_NSFDbClose( hdb& )
designReplace = True
End Function
Aufruf mit
' notesServerName1 as Notesname (usw...)
' dbNames ist die geöffnete lokale names.nsf
' PERNAMESTEMPLATE = "pernames.ntf"
doDesignReplace = designReplace("", dbNames.Filepath, notesServerName1.Canonical, PERNAMESTEMPLATE)
und das funktioniert bis zu rc% = W32_DesignRefresh