Today I remembered an workaround in Lotusscript I used in the past to prevent documents from being pasted into an application. The key is an Agent set to be triggered ‘When documents are pasted’.
The code of the Agent looks like this (for the ease of reading no error handling has been included):
Sub Initialize
Dim session As NotesSession
Dim db As NotesDatabase
Dim colPasted As NotesDocumentCollection
Dim doc As NotesDocument
Dim docRemove As NotesDocument
Set session = New NotesSession
Set db = session.CurrentDatabase
Set colPasted = db.UnprocessedDocuments
Set doc = colPasted.GetFirstDocument
Do While Not doc Is Nothing
Set docRemove = doc
Set doc = colPasted.GetNextDocument(doc)
Call docRemove.RemovePermanently (True)
Loop
Msgbox "You are not authorised to paste documents into this application.",16,"Error"
End Sub
The key in this solution is the usage of two NotesDocument objects, doc holding the current document to work on and docRemove containing the actual document to be removed. If doc would have been remove prior to using the GetNextDocument method of the collection, the collection would be unable to identify the next document.
I believe that there are other solutions out there. One possible option would be to immediately flag the pasted document to not show up in any view any more and to delete via a background maintenance agent. It would be interesting to hear how others are preventing documents from being pasted.