How to retrieve the template name for a Lotus Notes database


The Lotus Notes NotesDatabase class provides a method to determine a template name, but it only works for the template file itself -- template.ntf.

As far I could find out, there is no prescribed method to grab the true template name for a Lotus Notes database.

Upon further research, I found out that the name is stored in the NotesDatabase icon. The icon can be accessed as any other Lotus Notes document.

From Lotus Notes/Domino R6 on, there is a new class -- called NotesNoteCollection. The NotesNoteCollection class represents a collection of Lotus Domino design and data elements in a Lotus Notes database.

I did a quick debug to find the proper place to look for the template name value. Below, you will find LotusScript code that will retrieve the name of a template used for a specific Lotus Notes database.

 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 = "No Template"
Set nc = db.CreateNoteCollection( False )
nc.SelectIcon = True
Call nc.BuildCollection
Set icon = db.GetDocumentByID
( nc.GetFirstNoteId )
If not icon Is Nothing Then
getTemplate = 
End If

End Function


How about using the DesignTemplateName property of the NotesDatabase object. This gives direct access to the template name that a database inherits it from.
—Thierry S.


Why not just use the database property: DesignTemplateName?

Dim db As New NotesDatabase
(<server name>, <path\file name>)
template$ = db.DesignTemplateName

—Steen H.


The "Icon" design document has a fixed NoteID, therefore you do not need to skip through design elements to get this design document. Just simply use the following:

set doc = db.GetDocumentByID("FFFF8010")

FFFF is NOTE_ID_SPECIAL which can be 
used instead of using API call NSFDbGetSpecialNoteID.

Using this method, you can, easily get the following design documents, for example:

set doc = db.GetDocumentByID("FFFF8004") 
set doc = db.GetDocumentByID("FFFF8008") 

—Dennis F..

Do you have comments on this tip? Let us know.

Related information from SearchDomino.com:

  • Tip: Finding files and directories with LotusScript
  • FAQ: LotusScript advice
  • Learning Guide: LotusScript development

    This tip was submitted to the SearchDomino.com tip library by member Ulrich Krause. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

    This was first published in August 2006

  • There are Comments. Add yours.

    TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

    REGISTER or login:

    Forgot Password?
    By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
    Sort by: OldestNewest

    Forgot Password?

    No problem! Submit your e-mail address below. We'll send you an email containing your password.

    Your password has been sent to:

    Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.