LotusScript code to compare number of marked messages

Email monitoring
Lotus Notes
When sending email to multiple addressees and receiving answers which are again sent to many users, this creates a large amount of redundant information. Is there any LotusScript code that I could use to compare a number of marked messages with a defined "master message" (usually the newest) and remove duplicate sections in the marked (older) messages?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Well that’s really two questions isn’t it? First, how to get a handle on the documents and there contents, and second, what algorythm to use to compare and trim the text?

To get a handle on the selected documents, you only have to use the database unprocessed documents collection. From an agent set to run on selected documents, this will always return the selected documents. The documentation says they are returned in random order, but actually that’s not true. They are, in fact, returned in the order they were added to the database, so you can easily grab the most recent document without any need to sort or process the list.

Then you have to look at the contents. The Body field in a Notes email is a RichText field and LotusScript only provides an easy way to get at its text contents. So if you want to be able to preservce rich text contents, your little project is quickly going to get very costly. But if you are content to trim the older messages down to archival text, you might do something like this:

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim Selected As NotesDocumentCollection
Dim Doc As NotesDocument
Dim Master As NotesDocument

Set db=session.CurrentDatabase ‘ Get handle to database
Set Selected=db.UnprocessedDocuments ‘ Get collection of all selected documents.

Set Master=Selected.getnthdocument(1)
Dim MasterBody As NotesRichTextItem
Dim MasterBodytext As String
For i=1 To Selected.Count ‘ Scan selected documents (In the order they were added to the database).
Set doc=Selected.getnthdocument(i)
Dim Body As NotesRichTextItem
Dim Bodytext As String

Set Body = new NotesRichTextItem(Doc,”Body”,TheTextToKeep)
Call Doc.Save(True,false,false)
Next ‘ i

End Sub

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: