hcl-bot
January 23, 2008, 11:09am
1
Hello everybody,I have the following problem and I like to ask you some help…
Our general manager would like to delegate all mails in his mailbox to his assistant. All mails BUT those from our President and an other person. My idea is to work with an agent, triggered after new mail arrives, that modify or add the Readers Field of the single message to let just the owner of the mailbox to see that message.
Unfortunately I’m not so good in Lotus Script and this is why I’m asking your help. Anybody has some suggestions?
Thanks a lot in advance,
Patrizio
hcl-bot
January 23, 2008, 10:14pm
2
Subject: Readers Field: Need help
here’s some basic code.dim s as new notesSession
dim db as notesDatabase
dim dc as NotesDocumentCollection
dim doc as NotesDocument
dim item as NotesItem
dim sReaders(3) as String
sReaders(0) = “LoaclDomainServers” 'So that the mail server can see this memo
sReaders(1) = “Administrators” ’ So that administrators can see the memo
sReaders(2) = “OtherDomainServers”’ so that other domain server can see the memo
sReaders(3) = “GMName/Company” ''full hierarchical name. so the gm can see the memo
set db = s.CurrentDatabase
set dc = db…UnprocessedDocuments
if dc.Count = 0 then exit sub
set doc = dc.GetFirstDocument
while not doc is nothing
if instr(lcase(doc.getitemValue(“From”)(0)), “president name”) > 0 or instr(lcase(doc.getitemValue(“From”)(0)), “other person name”) > 0 Then
set Item = doc.replaceItemValue(“ReadControl”, sReaders)
item.IsReaders = true
Call doc.Save(false, False)
end if
set doc = dc.getnextdocument(doc)
wend
Hope it helps…
Chin Perera
Subject: RE: Readers Field: Need help
Hello, thank you Chin!It seems to be the script I was looking for…
But I need some further help, because I get an error of Type Mismatch when it tries to get the “From” value.
while not doc is nothing
if instr(lcase(doc.getitemValue(“From”)(0)), “president name”) > 0 or instr(lcase(doc.getitemValue(“From”)(0)), “other person name”) > 0 Then
I modified the script adding these:
Dim abc As Variant
…
while not doc is nothing
set abc = doc.getitemValue(“From”)(0)
…
I used the debugger to run the script step by step, and I always get the error Type mismatch at the set abc = … line.
Is there some kind of error?
Thanks a lot in advance!
Patrizio
Subject: RE: Readers Field: Need help
Hello, thank you Chin!It seems to be the script I was looking for…
But I need some further help, because I get an error of Type Mismatch when it tries to get the “From” value.
while not doc is nothing
if instr(lcase(doc.getitemValue(“From”)(0)), “president name”) > 0 or instr(lcase(doc.getitemValue(“From”)(0)), “other person name”) > 0 Then
I modified the script adding these:
Dim abc As Variant
…
while not doc is nothing
set abc = doc.getitemValue(“From”)(0)
…
I used the debugger to run the script step by step, and I always get the error Type mismatch at the set abc = … line.
Is there some kind of error?
Thanks a lot in advance!
Patrizio
hcl-bot
January 23, 2008, 11:35am
5
Subject: Readers Field: Need help
How about just create a mail rule and forward anything not from the President?