Document encryption using server agent

Anyone help with this?

I am trying to get an agent running on a server to encrypt a field in a document. I get this error:

“You must have permission to encrypt documents for server based agents”

The server has permission to run unrestricted methods and operations (server document in NAB).

I have imported the secret encryption key into the server’s ID file (the help doesn’t tell you to do this, but how else is the server going to do it?).

The agent is coded:

Dim s As New NotesSession

Dim db As NotesDatabase

Set db = s.CurrentDatabase

Dim doc As NotesDocument

Set doc = db.CreateDocument

doc.Form = "passwd"

doc.Name= "test"

Set item = doc.ReplaceItemValue("passwd", "highly secret")

item.IsEncrypted = True

doc.EncryptionKeys = "passwd"

doc.descr = "encryption by server agent"

Call doc.Encrypt ' this line gives the error

Call doc.save(False, False)

Exit Sub

Subject: document encryption using server agent

If anyone still has this problem, you can fix it be setting the agent runtime security to ‘2. allow restricted operations.’