I have a db that we use the doc.Encrypt method. It works except for someone with Author access in the ACL. I get the Cannot Encrypt document Instantiated from NotesUIDocument when I am in Edit mode or in Read mode and I am setup as Author. If I am setup as Manager (haven’t tested Designer or Editor), I can run the script fine in Edit and Read.
Action Button code:
Edit Mode
@Command([FileSave]);
@Command([ToolsRunMacro]; “(Encrypt)”);
@Command([FileCloseWindow])
Read Mode
@Command([ToolsRunMacro]; “(Encrypt)”);
@Command([FileCloseWindow])
Encrypt code snippet
Dim session As NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim Collection As NotesDocumentCollection
Dim item As NotesItem
Dim sitem As NotesItem
Set session = New NotesSession
Set db = session.CurrentDatabase
Set Collection = db.UnprocessedDocuments
If Collection.Count = 0 Then
Msgbox "No documents have been selected.", 0 + 16, "Warning"
Exit Sub
End If
Set Doc = Collection.Getfirstdocument
Call EncryptionFields (Doc, item)
Set sitem = Doc.GetFirstItem (“StatusComments”)
Call sitem.AppendtoTextList( Format(Now(), “Medium Date”) + ": Approved by " + Session.CommonUserName )
Doc.EncryptionKeys = “Key”
Call doc.Encrypt
Call Doc.Save (True, True)