
As described in an easier post (Loving policies – especially mail settings) we have been using the mail settings document introduced in Domino 7 to apply calendar settings to users mail databases. More specifically we have been enabling the “Allow Notes to update To Do status and dates for incomplete entries” setting on the calendar profiles so that To-Do’s that hasn’t been completed flow along to the next day.
This functionality is implemented by scheduling an agent in the users mail database. The agent is called “Update Tasks” and by default it is enabled to run at 1AM when the above setting is enabled by the user.
However there is a problem by enabling this setting using mail settings. The setting is correctly applied to the calendar profile documents but the “Update Tasks” agent isn’t being enabled. The effect is that you think the setting is enabled but in fact it isn’t.
Two things to do now:
- Write an agent to enable the agent across mail databases
- Call Lotus Support
Bummer… ๐
(The particular server is on Domino 7.0.)
Update: Here’s an agent to enable the agent. Create an agent in the Domino Directory and run it on selected users. Since it is Java-week here at lekkimworld the agent is in Java… ๐
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext ac = session.getAgentContext();
DocumentCollection dc = ac.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
Document docTemp = null;
while (null != doc) {
Name nn = session.createName((String)doc.getItemValue("FullName").elementAt(0));
// get mail database
Database db = session.getDatabase(
doc.getItemValueString("MailServer"),
doc.getItemValueString("MailFile"));
try {
// get calendar profile and see if setting is enabled
Document docProfile = db.getProfileDocument("CalendarProfile", null);
if (docProfile.getItemValueString("TaskFollow").equals("1")) {
// setting enabled - get agent
Agent a = db.getAgent("Update Tasks");
if (!a.isEnabled()) {
// set run-on server to mail server to be safe
a.setServerName(doc.getItemValueString("MailServer"));
// enable agent
a.setEnabled(true);
// save agent
a.save();
// log
System.out.println("[OK] Enabled 'Update Tasks' for " + nn.getAbbreviated());
} else {
// log
System.out.println("[OK] 'Update Tasks' already enabled for " + nn.getAbbreviated());
}
} else {
System.out.println("[NO] " + nn.getAbbreviated() + " doesn't have setting enabled...");
}
} catch (NotesException e) {
System.out.println("[ERROR] Unable to process user (" +
nn.getAbbreviated() + "): " + e.text + " (id: " + e.id + ")");
}
docTemp = dc.getNextDocument(doc);
doc.recycle();
doc = docTemp;
}
} catch(Exception e) {
e.printStackTrace();
}
}
}