Lotus Notes FAQ Visit Our Sponsor!

How do you delete the current document?

The easiest way to do this is to call this agent via ?OpenAgent from the current document:

Sub Initialize
  Dim s As New notessession
  Dim db As notesdatabase
  Dim rdoc, doc As notesdocument
  Dim uid  As String
  Dim returnto As String
   ' Get current document
  Set rdoc = s.DocumentContext
  Set db = rdoc.ParentDatabase
  Set  doc=db.GetDocumentByunID(uid$)
   ' Get the parent document so that you can bounce the user back to it after the deletion
  returnto$= Left(returnto$,Instr(Strconv(returnto$,2),".nsf/")+3)+"/all/"+doc.parentdocumentunid+"?Opendocument"
  Call doc.remove(True)
  Print "["+returnto$+"]"
End Sub

Applies to Notes Versions: 4, 4.5, 4.6, 5
Last Modified: September 8, 1999