How to programmatically delete a particular email in all mail files

  • 09 Apr, 2016

This can be done using an agent that is run by an ID that has access and delete rights to all the mail files on the server. The email will have the same Universal ID(UNID) in all of the mail files. This will allow you to get a handle on that particular email. The example code below gets a handle to the People view of the server’s name and address book. From the person document, it obtains the mail file for the user and then opens the mail file, locates the email and removes it.

The first step is to locate the UNID. This can be found by bringing up the document properties for the email you want to remove and looking at the beanie tab:

The UNID will be the 32 characters on the first 2 lines without the OF from the first line and the ON from the second line. Also, do not include the colon : on the 2 lines. So, the UNID for the above screen shot would be - EF883FE6FC7A14D185257F8E005D7D7D

The following code is an example that can be used to accomplish this. Please note that this code is provided as an example only. IBM support will not be able to modify or customize this agent. A version of this agent will need to be run on all mail servers in your environment. It can be set to run as a scheduled agent or via action menu selection. The target in both the scheduled version and action menu selection should be set to None

Sub Initialize Dim s As New NotesSession Dim perdoc As NotesDocument Dim pview As NotesView Dim mailDB As NotesDatabase Dim db As NotesDatabase Dim strServerName As String Dim doc As NotesDocument

On Error Resume next

’Set the strServerName variable to point to your server name strServerName = “YourServer/YourDomain” Set db = s.Getdatabase(strServerName, “Names.nsf”, False) Set pview = db.GetView(“($People)”) Set perdoc = pview.GetFirstdocument While Not perdoc Is Nothing Set maildb = s.Getdatabase(strServerName, perdoc.Getitemvalue(“mailFIle”)(0), False) If Not maildb Is Nothing Then Set doc = maildb.Getdocumentbyunid(“”) If Not doc Is Nothing Then Call doc.Removepermanently(True) End If End If Set perdoc = pview.Getnextdocument(perdoc) Wend End Sub

I found the information above on http://www-01.ibm.com/support/docview.wss?uid=swg21980866

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