Infos - Ingenieurbüro Manfred Dillmann

Wenn Sie in einer Datenbank mit einer grossen Anzahl von Ordnern eine Designänderung durchführen möchten (jeder Ordner soll z.B. eine zusätzliche Spalte erhalten), muss i.d.R. jeder dieser Ordner mit dem Designer Client geändert werden. Den hierzu erforderlichen Zeitaufwand können Sie sich leicht vorstellen.

Es existiert für solche Belange die undokumentierte Funktion @UpdateViewDesign, die von IBM z.B. in der Maildatenbank verwendet wird. Durch diese Funktion kann das Design eines bestehenden Ordners oder einer Ansicht auf einen anderen weiteren Ordner oder Ansicht übertragen werden.

Die nachfolgenden Informationen inkl. des LotusScript Beispielcodes entstammen dem ArtikelSample Agent for Updating Existing Folders in a Db When they Do not Exist in the Inherited Template (#1086404) aus der IBM Lotus Knowledgebase.


To solve this issue, an undocumented @function called @UpdateViewDesign can be used. This @function exists in Notes R5 Client and Domino R5 Designer, and will update the design of one view or folder with another specified by the @Function.

@UpdateViewDesign(targetView; sourceView)
targetView – view or folder having its design replaced
sourceView – view or folder design used to update the targetview

The sample „Update View Designs“ agent below uses the LotusScript IsFolder property (of the NotesView class). The sample agent opens every design note to check whether or not it is a folder. The IsFolder’s current design requires the view/folder to be opened in order to determine whether or not it is a view or folder. In doing so it ends up building an index for every design note it touches just as if the user were to open the view or folder manually, via the GUI. Indexes are built for hidden views as well. Therefore, the database grows in size after running the agent because every view and folder has been indexed regardless if the user ever touched it or used it. Lotus Software is aware of this issue. Refer to the document, „Using the LotusScript NotesView-Classes IsFolders Property Causes View Index to be Built or Rebuilt“ (#197914).

This workaround should not be used with releases of Notes R5 prior to 5.0.3 because there was a problem with the @UpdateViewDesign function in prior releases. Refer to the Supporting Information section below for more information. @UpdateViewDesign is considered undocumented; customers must use it at their own discretion.

In order to update all of the folders or views in a database the @UpdateViewDesign function could be used in a LotusScript agent. The example below demonstrates how to use the UpdateViewDesign function to update a user’s folders within their Mail file.

The following agent uses the Inbox design as the replacement parameter. Every folder (except the standard folders) is replaced with the R5 Inbox design. If there are folders that exist in the template that are erroneously updated, then the database’s design must be refreshed after these agents have been run in order to get them correctly back into the mail file.

Note: The Notes Client must be restarted after running the agents for the design update to take effect.

The following is a sample script, provided only to illustrate one way you can approach this functionality. Notes Support does not support this script and will not be able to customize it for a customer’s specific configuration.

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim profile As NotesDocument
Dim item As NotesItem
Dim agent As NotesAgent

Dim macro_pre As String
Dim macro_post As String
Dim macro As String
Dim ignore_list List As Integer
Dim view_name As String
Dim front As String
Dim back As String
Dim slashpos As Integer

‚ Strings to build the evaluate macro dynamically
macro_pre = |@UpdateViewDesign(„|
macro_post= |“; „($Inbox)“) |
Set db = session.CurrentDatabase

‚ Build the list of views to ignore
ignore_list(„($Inbox)“) = 1
ignore_list(„(Rules)“) = 1
ignore_list(„(Group Calendars)“) = 1
ignore_list(„($Trash)“) = 1
ignore_list(„($Alarms)“) = 1
ignore_list(„($Contacts)“) = 1
ignore_list(„($Calendar)“) = 1
ignore_list(„(To do’s\By Category)“) = 1
ignore_list(„(To do’s\By Status)“) = 1
ignore_list(„($Meetings)“) = 1
ignore_list(„Trash“) = 1
ignore_list(„(Discussion Threads)“) = 1
ignore_list(„($All)“) = 1
ignore_list(„($Drafts)“) = 1
ignore_list(„($HeadlinesView)“) = 1
ignore_list(„($Sent)“) = 1
ignore_list(„($SoftDeletions)“) = 1
ignore_list(„($ToDo)“) = 1
ignore_list(„Stationery“) = 1
ignore_list(„($FolderInfo)“) = 1
ignore_list(„($FolderRefInfo)“) = 1
ignore_list(„($VIM98)“) = 1
ignore_list(„($VIM42)“) = 1
ignore_list(„($VIM256)“) = 1
ignore_list(„($VIM23)“) = 1
ignore_list(„($VIM100)“) = 1
ignore_list(„($RepeatLookup)“) = 1
ignore_list(„($Profiles)“) = 1
ignore_list(„($POP)“) = 1
ignore_list(„($POPUIDL)“) = 1
ignore_list(„($POP3)“) = 1
ignore_list(„($PeopleGroupsFlat)“) = 1

Forall v In db.Views
‚ Just get the view name one time
‚ and store it rather than continually accessing it
view_name = v.Name
If v.IsFolder And (Iselement( ignore_list(view_name)) = False) Then
‚ We do this next bit so slashes don’t get
‚ stripped out of the view name when passed
‚ to UpdateViewDesign
slashpos = Instr( view_name, „\“ )
While slashpos
view_name = Left(view_name, slashpos) & „\“ & Right( view_name, _
Len(view_name) – slashpos)
slashpos = Instr(slashpos+2, view_name, „\“ )
‚ Now build the macro and execute it on the fly
macro = ( macro_pre & view_name & macro_post)
Evaluate( macro )
End If
End Forall
End Sub

Notes/Domino Version: 5.x

Ähnliche Beiträge