by
Paul Farris
on Wed 19 May 2010 14:40 BST |
Permanent Link
|
Cosmos
An old problem but one which does not look like it will go away. User deletes a rule and the it continues to be executed even though it is not in the list of rules in the mailbox.
The following lotusscript can be put into a hotspot button and emailed to the user to execute. It disables all of the rules and then the user can just enable the rules that they would like to continue executing.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.currentdatabase
Dim workspace As New NotesUIWorkspace
'This folder contains all the Mail Rules.
Dim folder As NotesView
Set folder = db.GetView("(Rules)")
'Find the calendar profile document in the current database. (GetProfileDocument will create the named profile document if it does not already exist.)
Dim calendarProfile As NotesDocument
Set calendarProfile = db.GetProfileDocument( "CalendarProfile" )
'Mail Rules are compiled and saved in special fields named $FilterFormula_xx
'Remove all of these fields from the calendar profile.
Forall item In calendarProfile.Items
If( Lcase$(Left$(item.Name,15)) = "$filterformula_" ) Then
Print "Cleanup " & item.Name
Call item.Remove
End If
End Forall
'Save changes to the calendar profile.
Call calendarProfile.Save( False, False )
'Disable all Rules.
Dim mailrule As NotesDocument
Set mailrule = folder.GetFirstDocument
While Not( mailrule Is Nothing )
Call mailrule.ReplaceItemValue( "Enable","0" )
Call mailrule.Save( True,False,True )
Set mailrule = folder.GetNextDocument( mailrule )
Wend
'Open the Rules folder
Call workspace.OpenDatabase( db.Server, db.FilePath, "(Rules)" )
'Message to the user.
Messagebox "Cleanup complete."
End Sub
This LotusScript was converted to HTML using the ls2html routine, provided by Julian Robichaux at nsftools.com. |
Thanks to Mark Thompson for posting this onto the 8.5 forum.