Subject: Prevent Cut to delete documnet in the Embedded view
Hi Aleksandr,
I’ll qualify this in that it’s quick, and I didn’t REALLY test it (in a frameset or on a server), so you may need to put in some error traps, etc. Also, fill in the right view and/or form name.
Offhand, I usually don’t allow users to delete anything, so I never give them delete permission to the database. If they want to delete they have to mash a button that marks the form for deletion, and an agent will act on the collection at periodic times - either archiving, or removing.
Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
Dim dbcollection As NotesDocumentCollection
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Set uiview = ws.CurrentView
Dim str_vName As String
If Not uiview Is Nothing Then
str_vName = uiview.ViewName
Msgbox "This is the current View: " + str_vName ,,"Debug"
Else
'Use this to trap a particular form that may be open
Set doc= ws.currentdocument.Document
If Not doc Is Nothing Then
str_vName = doc.Form(0)
End If
End If
If str_vName = "" Then
'Unremark this for debugging purposes
'Msgbox "Unable to get a handle on the view or form",,"Debug"
continue = True
Exit Sub
End If
Select Case Ucase(str_vName)
Case Ucase("Embedded View Name"), Ucase("Form Name")
Msgbox "Sorry, deleting documents in " + str_vName + " is not permitted",,"Cannot Delete"
Continue = False
Case Else
Continue = True
End Select
Subject: Re: Prevent Cut to delete documnet in the Embedded view
Marylin, thanks for the reply
I check Querydocumentdelete event more carefully and found that it works only on the server - if user create local replica of the database, he still can delete documents and replicate changes on the server. Is it possible to prevent it?
Subject: RE: Re: Prevent Cut to delete documnet in the Embedded view
It appears that an attempt to “Cut” a document will trigger the Querydocumentdelete code, and you can prevent users from cutting a doc the same way you keep them from deleting BUT! it doesn’t work the same in an embedded view - the querydocmentdelete doesn’t get triggered the same.