« Free Stuff at Thursday's DCNUG Meeting | Main| Domino.Doc Project Manager Position for Large Media Company in Washington, DC Area »

Change Notes Design Template Name With Lotusscript

QuickImage Category

I had a need to offer my client an easy way to change the design template for batches of user mail files, and went first to the Notes 6/7 Forum where I found this thread.  As you can see from that I managed to take a great little piece of code posted by "Rufus A" last year and make it suit my purposes.  Pretty cool - hey, I should blog about that!  But before I got too high on myself I figured I should do a wider search to see how "original" this really was.  Lo and behold, the OpenNTF Code Bin revealed this not so little gem posted by Davide Varotto and built on Damien Katz's DBDesign class that appears to offer much more comprehensive functionality.  While I haven't tested Davide's code, it certainly looks promising.

Speaking of OpenNTF, the agent I wrote in this case is perfect for organizations wanting to make a partial or gradual transition to standardizing on the OpenNTF Mail Experience template for user mail files.  What I've done is put together an agent that can be run from within the People view of the Domino Directory.  Just select the people you want to upgrade, run the agent, and run the design task on the server to trigger the refresh (or wait for it to run overnight).

I'm posting this under "Show-n-Tell Thursday" since I believe a lot of folks will find these various pieces of code extremely useful, but as is often the case, others deserve more credit.  Here is my working code:

Just drop this into an agent that can be called from the actions menu.  It has built in protections to detect when you've selected non-person docs, or if you don't have at least editor access to the Domino Directory.  The "better" way would be to add a button to the people view, but since that requires altering an existing design element, some organizations may not want to do that.  

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim Maildb As NotesDatabase
Set db = Session.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
If db.CurrentAccessLevel < 4 Then 'Change number according to your specific situation
       'Only Editors of the Domino Directory database are assumed to be able to run this agent
Messagebox "You have insufficient rights to run this agent.", 16, "Invalid Action"
Exit Sub
doc = dc.getfirstdocument
If doc.Form(0) <> "Person" Then
"This agent only works when one or more PERSON documents are selected.", 16, "Invalid Action"
                        Exit Sub
               End If
       End If
"Processing Mail Files..."
While Not doc Is Nothing
Maildb = Session.GetDatabase(doc.MailServer(0), doc.MailFile(0))
curTitle = Maildb.Title
Print "Processing Mail Files..." & Maildb.Title
Set iconDoc = Maildb.GetDocumentByID("FFFF0010")
iconDoc.~$Title = curTitle
Call iconDoc.Save(True,True)
Maildb.title = curTitle & Chr$(10)
                ' Now let's repeat the process since the first pass only clears out the existing template name
iconDoc = Maildb.GetDocumentByID("FFFF0010")
iconDoc.~$Title = curTitle
Call iconDoc.Save(True,True)
Maildb.title = curTitle & Chr$(10) & "#2" & "OpenNTFMailExperience"        ' Change to your own template name
' Print Maildb.title & " now inherits from " & Maildb.DesignTemplateName   'For debugging
Set doc = dc.getnextdocument(doc)
"Update Complete", 64, "Finished"
End Sub


1 - how to change mail templates in lotus notes

2 - how to desigen mail templates in lotus notes

Tools I Use

Idea Jam

Subscribe to This Blog

 Full Posts  Comments

netvibes Add to Netvibes


Hosted by



This site is in no way affiliated, endorsed, sanctioned, supported, nor blessed by Lotus Software nor IBM Corporation, nor any of my past or future clients (although they are welcome to do so). The opinions, theories, facts, etc. presented here are my own and in no way represent any official pronouncement by me on behalf of any other entity.

© 2005-2021 Kevin Pettitt - all rights reserved as listed below.

Creative Commons License
Unless otherwise labeled by its originating author, the content found on this site is made available under the terms of an Attribution / NonCommercial / ShareAlike