Tag: domino mail agent

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(“<Target document UNID goes here>”)
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

Domino Uncategorized