Does RunOnBehalfOf work for Foreground agent?

I have agent working in the UIDoc for normal users, the agent will issue a server console command onto the server. I’ve set the agent run on behalf of ‘Seerver name’. However when normal user click the button to run the agent, got error “You are not authorized to use the remote console on this server”.

I would like to know if RunOnBehalfOf works in foreground agent.

Subject: Does RunOnBehalfOf work for Foreground agent?

No it doesn’t.However, you could call run it in the foreground as a “Run on Server” agent. Then it would work.

e.g (from memory)

Dim sess as new notesSession

Dim db as notesDatabase

Dim agent as notesAgent

Set db=sess.currentDatabase

Set agent=db.getAgent(“My Agent”)

call agent.run0nServer

hth

Subject: Does RunOnBehalfOf work for Foreground agent?

If you do use “Run On server” you can not reference any notes UI objects (UIWorkspace, UIDocument…)

“Run On server” is kind of like scheduling an agent where UI objects are not allowed, only backend classes can be used with agents that actually run on the server.

Why do you need to issue server console commands? The error you are getting indicates the user does not have the proper admin access to issue server commands. The user would get the same message if they started Domino adminstrator, went to the live console and attempted to issue any server command. I would not recommend allowing users to enter any server console commands for security reasons.

What is it you are trying to accomplish?

Subject: RE: Does RunOnBehalfOf work for Foreground agent?

I would like users can ‘load compact -B’ , ‘load convert’ on their mail DB on behalf of Administrator. That would save a lots of time for our administrators.

Subject: RE: Does RunOnBehalfOf work for Foreground agent?

Why not just create a program document for the server to run this for you.

Subject: RE: Does RunOnBehalfOf work for Foreground agent?

because this is user-based.

For example, the user mail db is over quota, it has been cleaned up, however the file size would not reduce until run compact -B.

Subject: RE: Does RunOnBehalfOf work for Foreground agent?

Yes, I know it is user based, but the mail files exist on the server not on the user’s local machine. Look in Domino administrator help on compact and the options you can use with program documents.

If you run compact every night with the correct options, (which is what I recommend to all my clients running domino) it will take care of your problem.

You do not need to write an agent to do this.

If you want to compact local copies of the mail file, issuing server commands will not accomplish this since the users typically don’t run the domino server on thier local machines.