I would like to delete a mail database over a notes agent. Sometimes the mail databases have a replica.
Whats the best way to delete the mail file itself and also all other replicas (if they exist)? My code below looks like this, but it doesn't delete the mail file in a replica.
Dim mailfile As String
mailfile = "mail\doe.nsf"
Dim db As New NotesDatabase("", mailfile)
If db.IsOpen Then
'Mark to delete it later
Call db.MarkForDelete()
Else
'Delete now
Call db.Remove
End If
You could use the built in function to do this by using NotesAdministrationProcess:
If you do not want to wait for this (as it needs time: replicate admin4.nsf to all servers, execute admin process there, replicate back...), you can do this by yourself if you know the servers where the replicas are in advance:
REMARK: Your check for "db.IsOpen" does not help at all. As "IsOpen" does NOT return if a database is currently open somewhere. It returns, if YOUR SCRIPT was able to open the database at exaxtly that moment... I added an error handler to take this into account.