1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument, profile As NotesDocument
Dim vues As String
Dim serveur As String
Dim chemin As String
Dim noteID As String, champ As String, valeur As String
Dim Flag As Variant, number As Integer
serveur = NOM DU SERVEUR , par exemple "serveur/domaine"
chemin = CHEMIN VERS LA BASE, par exemple "mail\boitemail.nsf"
Flag = ws.prompt(PROMPT_YESNO,"Demande de confirmation", _
"Voulez vous réinitialiser les règles ?")
If CStr(Flag)="0" Then End
Dim db As New NotesDatabase("","")
If Not db.Open(serveur,chemin) Then
MsgBox "Impossible d'ouvrir la base !"
End
End If
Dim rulesfolder As NotesView
Dim rules As NotesViewEntryCollection
Dim rule As NotesViewEntry
Dim ruledoc As NotesDocument
Set rulesfolder=db.getview("Rules")
Set rules=rulesfolder.allentries
Set profile=db.GetProfileDocument("CalendarProfile")
'Optional code to remove rule entries from the Calendar Profile which did not disable as expected.
'The code can be used if you want to "clean out" the rule entirely in the profile.
'You have to re-enable your mail rules after running this script, and the calendar mini-view as well if you use it
' Remove miniview rule
If profile.getitemvalue("Use_CalendarRule")(0) = "1" Then
profile.Use_CalendarRule = "0"
MsgBox "Don't forget to re-activate the Calendar miniview afterward"
End If
' Remove all rules from the Calendar Profile
Call profile.removeitem("$FilterFormula")
Call profile.removeitem("$FilterFormulaCount")
ForAll ff In profile.Items
If ff.type = 1536 And LCase(Left(ff.name,15)) = "$filterformula_" Then
Call ff.remove
End If
End ForAll
Call profile.Save(True, True)
' Re-order the list of rules
number=1 ' leave the number 0 for the the miniview rule
Set rule=rules.getfirstentry
While Not rule Is Nothing
Set ruledoc=rule.document
ruledoc.ordernum=CStr(number)
ruledoc.Enable="0" ' Disable rule
Call ruledoc.save(True, True)
Set rule=rules.getnextentry(rule)
number=number+1
Wend
' Re-set the count of Filter Formulas Fields
If number > 1 Then
Call profile.replaceitemvalue("$FilterFormulaCount",number)
Call profile.Save(True, True)
End If
Call rulesfolder.Refresh
MsgBox "Opération réussie !" |
Partager