Je me suis permis de reprendre les infos postées pour en faire une classe "à la va vite"...
Son code évoluera au fil du temps et de mon temps.
Voici la v0.1
- Code : Tout sélectionner
Private Const ABOUT="FFFF0002"
Private Const DEFAULTFORM="FFFF0004"
Private Const DEFAULTVIEW="FFFF0008"
Private Const DATABASEICON="FFFF0010"
Private Const DBDESIGN="FFFF0020"
Private Const ACL="FFFF0040"
Private Const USINGDB="FFFF0100"
Private Const REPLICA="FFFF0800"
Public Class DocSpeciaux
%REM
Cette classe permet de récupérer le contenu des documents spéciaux
FFFF0002 : "About This Database" document
FFFF0004 : Default form
FFFF0008 : Default view
FFFF0010 : Database icon
FFFF0020 : Database Design Collection (view)
FFFF0040 : Database ACL
FFFF0100 : "Using This Database" document
FFFF0800 : Replication Formula
%END REM
Private m_session As NotesSession
Private m_db As NotesDatabase
Private m_docAbout As NotesDocument
Private m_docDefaultView As NotesDocument
Private m_docDefaultForm As NotesDocument
Private m_docIcon As NotesDocument
Private m_docDatabaseDesign As NotesDocument
Private m_docACL As NotesDocument
Private m_docReplicaFormula As NotesDocument
Private m_docUsingDB As NotesDocument
Private m_doc As NotesDocument
Sub new
Call init
End Sub
Private Function init
Set m_session=New NotesSession
Set m_db=m_session.CurrentDatabase
End Function
Private Function addElementToArray(a As Variant, element As Variant) As Integer
If Isempty(a) Then
Redim a(0)
Else
Redim Preserve a(Ubound(a)+1)
End If
a(Ubound(a))=element
End Function
Public Function getDocAbout() As Notesdocument
Set m_docAbout=m_db.GetDocumentByID( ABOUT )
Set getDocAbout=m_docAbout
End Function
Public Function getDocDefaultView() As NotesDocument
Set m_docDefaultView=m_db.GetDocumentByID( DEFAULTVIEW )
Set getDocDefaultView=m_docDefaultView
End Function
Public Function getDocDefaultForm() As NotesDocument
Set m_docDefaultForm=m_db.GetDocumentByID( DEFAULTFORM )
Set getDocDefaultForm=m_docDefaultForm
End Function
Public Function getDocIcon() As NotesDocument
Set m_docIcon=m_db.GetDocumentByID( DATABASEICON )
Set getDocIcon=m_docIcon
End Function
Public Function getDocDatabaseDesign() As NotesDocument
Set m_docDatabaseDesign=m_db.GetDocumentByID( DBDESIGN )
Set getDocDatabaseDesign=m_docDatabaseDesign
End Function
Public Function getDocAcl() As NotesDocument
Set m_docACL=m_db.GetDocumentByID( ACL )
Set getDocAcl=m_docACL
End Function
Public Function getDocReplicaFormula() As NotesDocument
Set m_docReplicaFormula=m_db.GetDocumentByID( REPLICA )
Set getDocReplicaFormula=m_docReplicaFormula
End Function
Public Function getDocUsingDB() As NotesDocument
Set m_docUsingDB=m_db.GetDocumentByID( USINGDB )
Set getDocUsingDB=m_docUsingDB
End Function
Public Function getItems(d As NotesDocument) As Variant
getItems=d.items
End Function
Public Function getFieldsNames(items As Variant) As Variant
Dim v As Variant
Forall f In items
Call addElementToArray(v,f.name)
End Forall
getFieldsNames=v
End Function
End Class
Un petit exemple permettant de l'exploiter et connaître quels sont les champs de ces documents
- Code : Tout sélectionner
Sub Initialize
Dim ds As DocSpeciaux
Dim d As notesdocument
Dim items As Variant
Dim names As Variant
Close
Open "c:\FieldsSpec.txt" For Output As 1
Set ds=New DocSpeciaux
Set d=ds.getDocDefaultView
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DefaultView"
Forall n In names
Print #1,n
End Forall
End If
Set d=ds.getDocIcon
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DocIcon"
Forall n In names
Print #1,n
End Forall
End If
Set d=ds.getDocDatabaseDesign
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DocDesign"
Forall n In names
Print #1,n
End Forall
End If
Set d=ds.getDocAcl
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DocACL"
Forall n In names
Print #1,n
End Forall
End If
Set d=ds.getDocReplicaFormula
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DocReplica"
Forall n In names
Print #1,n
End Forall
End If
Set d=ds.getDocReplicaFormula
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DocReplica"
Forall n In names
Print #1,n
End Forall
End If
Set d=ds.getDocDefaultForm
If Not (d Is Nothing) Then
items=ds.getItems(d)
names=ds.getFieldsNames(items)
Print #1,"=== Liste des champs pour DocDefaultForm"
Forall n In names
Print #1,n
End Forall
End If
Close
End Sub
voici le résultat obtenu dans le fichier
- Code : Tout sélectionner
=== Liste des champs pour DefaultView
$TITLE
$Index
$UpdatedBy
$Formula
$FormulaClass
$Collation
$VIEWFORMAT
$Comment
$Flags
$DesignerVersion
$Signature
$Collection
=== Liste des champs pour DocIcon
$Flags
$TITLE
$UpdatedBy
IconBitmap
=== Liste des champs pour DocDesign
$DesignVersion
$Version
$Formula
$FormulaClass
$Collation
$UpdatedBy
$Collection
=== Liste des champs pour DocACL
$ACLDigest
$Signature
$UpdatedBy
=== Liste des champs pour DocDefaultForm
$TITLE
$Info
$UpdatedBy
$Flags
$DesignerVersion
$$ScriptName
membres
$Fields
$Body
$Signature
Il me reste à travailler sur le contenu des champs et offrir des méthodes permettant d'obtenir le contenu d'un de ceux-ci et aussi pourvoir les modifier quand cela est possible (enfin si Notes veut bien)
Bien à vous
http://www.dominoarea.org/oguruma/
Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci
Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)