wenn die private View uff dem Server liegt, kann man auch das machen (s.u.). Ist ein alter Code, aber klappte immer. Gibt mittlerweile auch neuere. Das kommt ins PostOpen des Datenbankscripts. Läuft nur einmal täglich, wenn User reingeht. Wert wird in Notes.ini dazu abgelegt, damit nicht bei jedem Öffnen der Käse läuft.
Sub Postopen(Source As Notesuidatabase)
%REM ====================================================
This code removes out-of-date private views stored on the server.
Each time the database is opened, it searches for private views. For each private view, it compares
the Created date to the LastModified date of the corresponding shared view. If the shared view design
was updated after the private view was created, then we know that the private view's design is out of date.
The private view is then removed and the user is issued a message box advising that they close and reopen
the database.
Usage: This code can be used ad-hoc by the database manager to remove all private views. It is more efficient that way,
but requires manual execution.
For R5.0 and later, use the isPrivate property of NotesView rather than isPrivateView(v)
22 March 1999
Jamie Magee
Martin Scott Consulting LLC
McLean, Virginia
www.MartinScott.com
Jamie.Magee@MartinScott.com
(c) copyright 1999 Martin Scott Consulting LLC
%END REM =================================================
Dim session As New notessession
Dim Eintrag As String
Eintrag = session.getenvironmentstring("pbtraxx")
Dim Heute As String
Heute = Today()
If Heute = Eintrag Then
Exit Sub
End If
Set db = Source.database '...works in Database PostOpen event, modify for other contexts
count=0
privateviewtext=""
Dim masterView As NotesView
tot = Ubound(db.views) + 1
Forall v In db.views
count=count+1
Print "Suche veraltete, private Ansichten " & count & " von " & tot & "..."
If isPrivateView(v) Then
Set masterView = getMasterView(v) '...get the shared view on which this personal view is based
If Not(masterView Is Nothing) Then
If v.Created < masterView.LastModified Then '...if the shared view design was updated after the private view was
'...then remove the private view
privateviewtext=privateviewtext & Chr(10) & v.name
v.remove
End If
End If
End If
End Forall
If privateviewtext="" Then
Print "Keine veralteten Ansichten gefunden."
Else
Print ""
Messagebox "folgende private ""Meine"" Ansichten mußten entfernt werden:" & privateviewtext & Chr(10) & "Schließen Sie die Datenbank und gehen wieder hinein."
End If
Call session.setenvironmentvar("pbtraxx",Heute)
End Sub
Function isPrivateView(v As NotesView) As Integer
isPrivateView = False
Set vdoc = v.parent.GetDocumentByUnid( v.UniversalID )
If Not (vdoc Is Nothing) Then
If vdoc.HasItem("$Flags") Then
If Instr(vdoc.GetItemValue("$Flags")(0), "V") Then
isPrivateView = True
Exit Function
End If
End If
End If
End Function
Function getMasterView(pView As NotesView) As NotesView
Set db = pView.parent
viewList = db.views
Dim view As NotesView
Forall v In viewList
If v.Name = pView.Name Then
Set view = v
If Not(isPrivateView(view)) Then
Set getmasterView = v '...get the shared view on which this personal view is based
Exit Function
End If
End If
End Forall
Set getMasterView = Nothing
Print "Die ursprüngliche Vorlage der privaten Ansicht '" & pView.name & "' konnte nicht gefunden werden."
End Function