Das ist der Agent:
' If someone deletes a rule before he/she disables it, this agent will get rid of those. In so doing, it will also disable any rules that might be active at that time.
Sub Initialize
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim profile As NotesDocument
Dim doc As NotesDocument
Dim rules As NotesView
Dim item As NotesItem
Dim server As String
Dim DBPath As String
Dim count As Integer
count = 0
server = ws.Prompt(PROMPT_OKCANCELEDIT, "Server", "Specify the name of the server that the DB with the bad rules is on.")
DBPath = ws.Prompt(PROMPT_OKCANCELEDIT, "DB Filepath", "Specify the filepath to the DB that needs to be fixed.")
Set db = New NotesDatabase(server, DBPath)
If Not db.IsOpen Then
Messagebox "The server or DBPath was entered incorrectly." & Chr(10) & "Server: " & server & Chr(10) & "DB Filepath: " & DBPath
Exit Sub
End If
Set profile = db.GetProfileDocument("CalendarProfile")
Set rules = db.GetView("Rules")
' Disable all of the rules that there are. Period!!!
If Not profile Is Nothing Then
If rules.AllEntries.Count > 0 Then
Call profile.ReplaceItemValue("$FilterFormulaCount", Cstr(rules.AllEntries.Count))
Elseif profile.HasItem("$FilterFormulaCount") Then
Call profile.RemoveItem("$FilterFormulaCount")
End If
Forall items In profile.Items
If items.type = 1536 Then
If Lcase(Left(items.name,7)) = "$filter" Then
Call items.remove()
End If
End If
End Forall
Call profile.Save(True,True,True)
End If
' Mark the bit on every rules document still present in the rules folder for disabled and be sure that the ordernum starts at 0
Set doc = rules.GetFirstDocument()
While Not doc Is Nothing
Call doc.ReplaceItemValue("Enable", "0")
Call doc.ReplaceItemValue("OrderNum",count)
count = count + 1
Call doc.Save(True,False,True)
Set doc = rules.GetNextDocument(doc)
Wend
Call rules.Refresh()
End Sub