Monday, September 26, 2011

Rename a Notes view with LotusScript?

The following example will rename a Notes view.

IMPORTANT NOTE: The following is a sample script, provided only to illustrate one way to
approach this issue. In order for this example to perform as intended, the script must be laid out exactly as indicated below. Notes Support will not be able to customize this script for a customer's own configuration.

1. Define an agent with the following script:
2. Launch the agent.
3. Close all windows related to the database.
4. Reopen the database. The view is now renamed.

 Sub Initialize
'_____This script renames a view_____
Dim s As New NotesSession
Dim db As NotesDatabase
Dim v As NotesView
Dim doc As NotesDocument
Dim origView As String
Dim destView As String
origView = Inputbox("Enter the original name of the view ")
destView = Inputbox("Enter the new name of the view")
Set db = s.CurrentDatabase
Set v = db.GetView(origView )
Set doc = db.GetDocumentByUNID(v.UniversalID) 'from Object Oriented point of view, it's not
very clean!!!
Call doc.ReplaceItemValue( "$TITLE", destView )
doc.Save True, True
End Sub

No comments:

Post a Comment