Lotus Notes FAQ Visit Our Sponsor!

How do you delete a document by the UNID?

If you are using a $$QuerySaveAgent you can get the unid from the NotesSession.DocumentContext.UniversalID.
If you are running an agent with ?OpenAgent, append &UNID=docid to the end of the URL, where docid is either on the document that you are working with, or, is computed by Domino with @DocumentUniqueID and use the following as the delete agent:

Dim s As New NotesSession
Dim db As NotesDatabase
Dim tempdoc As NotesDocument
Dim realdoc As NotesDocument
Dim RealUNID As String
Dim readerlist As NotesItem
Dim templist As NotesItem

Set tempdoc = s.DocumentContext
Set db = s.CurrentDatabase
RealUNID$ = Right$(tempdoc.QUERY_STRING(0),32)
Set realdoc = db.GetDocumentByUNID(RealUNID$)

Call realdoc.remove(True)

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