All,
I have written a script to create the rules in user mail file. Rules are getting created, but not working.
I also updated the calendar profile document and the field $FilterFormulaCount, but still no luck.
Can someone share the code to update the calendar profile document and the field $FilterFormulaCount.
Script:
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim maildb As NotesDatabase
Dim newdoc As NotesDocument
Dim ruleDoc As notesuidocument
Dim profile As NotesDocument
Dim item As NotesItem
Dim viewcollection As notesviewentrycollection
Dim rulecnt As Integer
Set maildb = session.GetDatabase("XXX","mail\xxx.nsf")
Set View =maildb.GetView("Rules")
Set newdoc = New notesdocument(maildb)
newdoc.Form = "MailRule"
newdoc.ActionList = " send full copy to xxx@yyy.com"
newdoc.ConditionList = " To or CC contains xxx/org"
Set ruleDoc = ws.editdocument(True,newdoc,)
Call ruleDoc.save
Call ruleDoc.close
Set newdoc = ruleDoc.Document
Call newdoc.putinfolder("Rules")
ws.viewrefresh
Set viewcollection = view.allentries
rulecnt = viewcollection.count + 1
Set profile = maildb.GetProfileDocument("CalendarProfile")
If Not profile Is Nothing Then
Call profile.ReplaceItemValue("$FilterFormulaCount", Cstr(rulecnt))
Call profile.Save(False, False)
End If