Code a mettre dans un agent
change le masque par défaut des bases situées dans le repertoire mail du serveur et dont le modèle est iNotes6
Sub Initialize
'Parcours les bases du serveur et change le masque par défaut pour ceux répondant à certains critères
Dim dbdir As New NotesDbDirectory("NomDuServeur")
Dim db As NotesDatabase
Set db = dbdir.GetFirstDatabase(DATABASE)
While Not(db Is Nothing)
If Instr(db.FilePath, "mail")>=1 And db.DesignTemplateName="iNotes6" Then
Msgbox db.Title, , db.FileName
Call SetDefaultForm(db)
End If
Set db = dbdir.GetNextDatabase
Wend
End Sub
Sub SetDefaultForm(db As NotesDatabase)
np$ = Space(1024)
OSPathNetConstruct 0, db.Server, db.FilePath, np$
Dim hDB As Long
Dim Nid As Long
Dim hNT As Long
NSFDbOpen np$, hDB
' Récupère le masque nommé "Memo"
NIFFindDesignNote hDB, "Memo", NOTE_CLASS_FORM, Nid
' L'ouvre...
NSFNoteOpen hDB, Nid, 0, hNT
' Lui attribue l'information "masque par défaut..."
NSFNoteSetInfo hNT, NOTE_INFO_CLASS, NOTE_CLASS_FORM
' Et sauvegarde le tout
NSFNoteUpdate hNT, 0
NSFDbClose hDB
End Sub
Const NOTE_INFO_OID = 2
Const NOTE_INFO_CLASS = 3
Const NOTE_INFO_FLAGS = 7
Const ITEM_SIGN = 1
Const ITEM_SUMMARY = 4
Const TYPE_TEXT = &H0500
'Declaration
Declare Function NSFNoteOpen Lib "nnotes.dll" (Byval dbHandle As Long, Byval noteID As Long, Byval openFlag As Integer, retNoteHandle As Long) As Integer
Declare Function NIFFindDesignNote Lib "nnotes.dll" (Byval hDb As Long, Byval noteName As Lmbcs String, Byval classType As Integer, hNote As Long) As Integer
Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" ( Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" ( Byval hDB As Long) As Integer
Declare Private Function NSFNoteUpdate Lib wAPIModule Alias "NSFNoteUpdate" ( Byval hNT As Long, Byval F As Integer) As Integer
Declare Private Function NSFNoteSetInfo Lib wAPIModule Alias "NSFNoteSetInfo" ( Byval hNT As Long, Byval M As Integer, V As Any) As Integer
Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" ( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer
Declare Sub NEMDisplayError Lib "NNOTESWS" Alias "NEMDisplayError" ( Byval E As Long)