Manage Learn to apply best practices and optimize your operations.

Delete a document when it is opened in UI

This tip describes how to delete a document opened in the UI.

Have you ever tried to delete a document that is opened on your desktop (using NotesDocument.Remove(flag) method)? If you did, you probably received this error message: "Cannot remove NotesDocument when instantiated by NotesUIDocument". Use the following function to avoid this error message and delete the document.

Sub RemoveUIDOC(source
 As notesuidocument)
 Dim doc As notesdocument
 Dim unid As String
 Dim db As notesdatabase
 Set db = source.document.
 unid = source.document.UniversalID
 Delete source
 Set doc = db.GetDocumentByUNID(unid)
 Call doc.Remove(True)
End Sub

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...