Here is a quick LotusScript tip on how to get the name of the template that is used for a specific database. The NotesDatabase Class has a method to determine the template name. But this only works for a template file itself ( template.ntf ) As far a I could find out, there is no method to grab the template name for a database.
I found out theat the name is stored in the NotesDatabase icon. The icon can be accessed as any other Notes document. From Release 6 on there is a new class called NotesNoteCollection class . The NotesNoteCollection class represents a collection of Domino design and data elements in a database.
I did a quick debug to find the proper place to look for the template name value. Well, here is the code.
Function getTemplate( db As NotesDatabase ) As String Dim template As String, aux As String Dim nc As NotesNoteCollection Dim icon As notesdocument Dim noteid As String getTemplate = "" Set nc = db.CreateNoteCollection( False ) nc.SelectIcon = True Call nc.BuildCollection Set icon = db.GetDocumentByID( nc.GetFirstNoteId ) If Not icon Is Nothing Then getTemplate = icon.Parentdatabase.DesigntemplateName End If End Function
To test the code, put the funktion together with the following code into an action button in a view of your “sandbox” database
Sub Click(Source As Button) Dim s As New NotesSession Dim db As NotesDatabase Set db = s.currentdatabase Msgbox getTemplate ( db ) End Sub