Ich habe einen Agent mit folgendem Script erstellt
(Manuell aus dem Menü "Aktionen"):
Option Public
Option Declare
' Notes functions
Declare Function NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval filename As String, hdb As Long ) As Integer
Declare Function NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hdb As Long ) As Integer
Declare Function DesignReplace Lib "nnotes.dll" Alias "DesignReplace" ( Byval ht As Long, Byval hdb As Long, Byval dw1 As Long, Byval dw2 As Long, Byval dw3 As Long, Byval dw4 As Long ) As Integer
Sub ReplaceDesign( tpl As NotesDatabase, db As NotesDatabase )
Dim source As String
Dim target As String
Dim status As Integer
Dim ht As Long
Dim hdb As Long
' öffnen der >>Template-Datenbank<<
If tpl.Server="" Then
source=tpl.FilePath
Else
source=tpl.Server & "!!" & tpl.FilePath
End If
status=NSFDbOpen( source, ht )
If status<>0 Then Error 1, "Fehler beim öffnen von " & source & " (error code=" & status & ")"
' Öffnen der zu aktualisierenden Datenbank
If db.Server="" Then
target=db.FilePath
Else
target=db.Server & "!!" & db.FilePath
End If
status=NSFDbOpen( target, hdb )
If status<>0 Then
NSFDbClose ht
Error 1, "Fehler beim öffnen von " & target & " (error code=" & status & ")"
End If
status=DesignReplace( ht, hdb, 0, 1, 0, 0 )
NSFDbClose ht
NSFDbClose hdb
If status<>0 Then Error 1, "Fehler beim Ersetzen der Gestaltung " & (error code=" & status & ")"
End Sub
Und im Event 'initialize'
Dim ss As New notesSession
Dim tpl As NotesDatabase
Dim db As NotesDatabase
Set db = ss.CurrentDatabase
Set tpl = ss.GetDatabase("","SCHABLONE.ntf") ' Schablone
Call procReplaceDesign(tpl,db)