Creating mail rules in notes

By harshanaren ·
I am trying to create mail rules for lotus note user programmatically using .Here is my sample code

Dim db As Domino.IDatabase
Dim Session As Domino.ISession
Dim messagelist As New ArrayList
Session = CreateObject("Lotus.NotesSession")
Dim mailServer As String = Session.GetEnvironmentString("mailserver", True)
Dim mailFile As String
db = Session.GetDatabase(mailServer, mailFile)

Dim m_ruledoc As Domino.NotesDocument = db.CreateDocument
m_ruledoc.ReplaceItemValue("Form", "Mailrule")
m_ruledoc.ReplaceItemValue("action", "1")
m_ruledoc.ReplaceItemValue("condition", "1")
m_ruledoc.ReplaceItemValue("ActionListDisplay", "")
m_ruledoc.ReplaceItemValue("ConditionListDisplay", "")
m_ruledoc.ReplaceItemValue("behavior", "1")
m_ruledoc.ReplaceItemValue("logic", "1")
m_ruledoc.ReplaceItemValue("$KeepPrivate", "1")
m_ruledoc.ReplaceItemValue("Type", "1")
m_ruledoc.ReplaceItemValue("folder", "")
m_ruledoc.ReplaceItemValue("string", "")
m_ruledoc.ReplaceItemValue("TokActionList", "1|1|" + Drafts)
m_ruledoc.ReplaceItemValue("tokConditionList", "2|1|" + Test + "|0")
m_ruledoc.ReplaceItemValue("tokExceptionList", "")
m_ruledoc.ReplaceItemValue("importance", "0")
m_ruledoc.ReplaceItemValue("importancecond", "0")
m_ruledoc.ReplaceItemValue("operator", "0")
m_ruledoc.ReplaceItemValue("ExpireDates", "D")
m_ruledoc.ReplaceItemValue("ConditionList", " Body contains " + Test)
m_ruledoc.ReplaceItemValue("ActionList", " move to folder " + Drafts)
m_ruledoc.ReplaceItemValue("$FilterFormula", "")
m_ruledoc.ReplaceItemValue("Enable", "1")
m_ruledoc.ReplaceItemValue("PROTECTFROMARCHIVE", "1")
m_ruledoc.Save(True, True)

this code does create rule document but it creates in Alldocuments view instead of tools\Rules folder where rule resides. Also when i try to copy the rule from alldocuments folder to rule folder the rule does not get applied.Is it possible to create rule directly in rule folder so that it should get applied properly.Appreciate any help.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums