I need to create a view in a BD(a admin db kinnd) that shows me the template version of all the other databases! can anyone help me with this please!?
You don't need to create a database for this purpose, there is already one. It is called "catalog.nsf" and contains the Information you want. You just need to create a view and modify the selection- formula slightly: Original:
SELECT @IsAvailable(ReplicaID)& @IsUnavailable(RepositoryType)& !(DBListInCatalog = "0")
New:
SELECT @IsAvailable(ReplicaID)& @IsUnavailable(RepositoryType)
That way you see all databases, even the ones that normally are not visible in catalog.
The information you are looking for is in the "DbInheritTemplateName"- Field.
If you want to code this yourself, you can either run through all documents in the catalog.nsf and read it from there or you use a NotesDBDirectory, run through it and read the "DesignTemplateName"- property of NotesDatabase- Class.
Example code for catalog:
Dim dbCatalog as NotesDatabase
Dim dc as NotesDocumentCollection
Dim doc as NotesDocument
Dim strTemplate as String
Set dbCatalog = New NotesDatabase( "YourServerName" , "catalog.nsf" )
Set dc = dbCatalog.Search( "@IsAvailable(ReplicaID)& @IsUnavailable(RepositoryType)", Nothing, 0 )
Set doc = dc.GetFirstDocument()
While not doc is Nothing
strTemplate = doc.GetItemValue( "DBInheritTemplateName" )(0)
'- do whatever you want: create a document in your database, create a list...
Set doc = dc.GetNextDocument(doc)
Wend
Example code for NotesDBDirectory
Dim dbDirectory as New NotesDBDirectory( "YourServerName" )
Dim db as NotesDatabase
Dim strTemplate as String
Set db = dbDirectory.GetFirstDatabase( DATABASE )
While not db is Nothing
strTemplate = db.DesignTemplateName
'- do whatever you want: create a document in your database, create a list...
Set db = dbDirectory.GetNextDatabase
Wend