OpenNTF.org - PromptMailTemplateUsed - Get i
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
Edit Document Code By Date > Code Document
About This Code
Brief Description:
PromptMailTemplateUsed - Get information about the template your mail database inherits from. 
Rating:
Not Rated Yet 
Contributor:
John Smart 
Category:
Lotusscript 
Type:
Example Code 
Last Modified:
30 Oct 2008 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description

Sub PromptMailTemplateUsed()
'Written by John Smart John.Smart@GreyDuck.com
'Submitted to OpenNTF on 30 Oct 2008
'http://www.openntf.org/projects/codebin/codebin.nsf/CodeByDate/660570790A3B977B862574F2006E3E4F
	Dim db As New NotesDatabase("", "")
	Dim doc As NotesDocument
	Dim strMsg As String
	Dim strTemplateName As String
	Dim strTemplateServerName As String
	Dim strTemplateFileName As String
	
	Print "Finding your email database..."
	Call db.OpenMail()
	
	Print "Verifying that your email database inherits from a template..."
	strTemplateName = db.DesignTemplateName
	If Len(strTemplateName) = 0 Then
		Error 1000, "Your mail database doesn't inherit it's design from a template."
	End If
	
	
	Print "Getting information about where your mail template inherits from..."
	Set doc = db.GetDocumentByID("FFFF0010") 'icon design element.  Thanks to http://www.nsftools.com/tips/NotesTips.htm#defaultelements
	
	'Get template information stored in the icon design element.  Thanks to http://www.notesninjas.com/#TemplateFileName
	strTemplateServerName = doc.GetItemValue("$TemplateServerName")(0)
	strTemplateFileName = doc.GetItemValue("$TemplateFileName")(0)
	
	strMsg = |Design Template Name: | + strTemplateName + |
Server: | + strTemplateServerName + |
File Path: | + strTemplateFileName + |

NOTE: File Path is based on the server's operating system, so a File Path of "/local/notes/data/mail8.ntf" would imply that your template is probably "mail8.ntf" in the root data directory on your server.|
	
	Print ""
	Messagebox strMsg, 0, "Hints on where to find your mail template."
End Sub
Usage / Example
This example pools together the following:

- You can get design elements as NotesDocuments if you know their NoteID.
- The Icon design element always has the same NoteID and holds interesting information.

It would be better to have a function that returned a NotesDatabase object pointing to the template. If anyone has this, please reply below.

 Comments

No documents found

 Add your comment!