Delete particular mail from all mail files of the users selected from Domino Directory

  • 19 Feb, 2014

Some users make the mistake of sending messages that should not go to some people and  not save the sent message which complicates the use of the recall. I found this documentation in a TechNote that can help solve the problem

Create one LotusScript agent in Domino Directory with all default properties such as it will run on event and target documents are all selected documents.  Paste below code in the agent.

Save the agent and open domino directory from Notes Client.  Select the person documents for which users the mail has to be deleted from their mail file.  And then select Tools–><>.

Once successful, the confirmation message will be popped up.  Please ensure that the id by which agent will be signed should be present in mail file of user’s ACL.

Change subject text in below code.

Option Public
Option Declare

%Include "lsconst.lss"
Sub Initialize
        Dim s As New NotesSession
        Dim db As NotesDatabase
        Dim view As NotesView
        Dim dc As NotesDocumentCollection
        Dim doc As NotesDocument
        Dim db1 As NotesDatabase        
        Dim noofrec As Integer        
        Dim mailserv As String
        Dim mailfl As String
        noofrec = 0
        Dim doccol As NotesDocumentCollection
        Dim searchstring As String
        Dim doc1 As NotesDocument
        Dim doc2 As NotesDocument
       
        Set db=s.Currentdatabase
        Set view=db.Getview( "($Users)" )
        Set dc=db.Unprocesseddocuments
        Set doc=dc.GetFirstDocument
        searchstring ``"hi swati how r u"  'change this text
       
        While Not doc Is Nothing
                mailserv = doc.GetItemValue( "MailServer" )( 0 )
                mailfl = doc.GetItemValue ( "MailFile" )( 0 )
                Set db1 = s.GetDatabase(mailserv,mailfl)
                If Not db1 Is Nothing Then
                        If db1.IsOpen Then
                                Set doccol = db1.FTSearch(searchstring, 0 )
                                Set doc1 = doccol.GetFirstDocument
                                While Not doc1 Is Nothing
                                        Set doc2 = doccol.GetNextDocument(doc1)
                                        Call doc1.RemovePermanently( True )  
                                        Set doc1 = doc2
                                Wend
                                noofrec = noofrec + 1
                        End If
                End If
                Set doc = dc.Getnextdocument(doc)
        Wend        
        If noofrec <> 0 Then
                MsgBox noofrec & ``" record(s) successfully updated " , MB_OK, ``"Lotus Notes"
        End If
        End sub

Related Posts

Migrating messages from Domino to Google using IMAP

  • 20 Feb, 2022

It's only for messages. No calendar migration Imapsync command is a tool allowing incremental and recursive imap transfers from one mailbox to another. If you don't understand the previous sentence,

Migrating messages from Domino to Google using IMAPRead More

Domino V12 and Verse 2.1 How to add a Photo URL

  • 08 Jun, 2021

Today i setup a Domino V12 server just for test some new features. A customer ask to use photos on Verse hosting photos on Domino. Domino V12 comes with Verse 2.0. I just download the version 2.1 of

Domino V12 and Verse 2.1 How to add a Photo URLRead More

Notes / Domino is forever

  • 04 Feb, 2021

Yesterday it seemed like it would be an ordinary working day but a client called me informing about the expiration of a certifier. It would be normal to resolve the problem with the re-certification p

Notes / Domino is foreverRead More