Out of office - set programattically

I am trying to programatically set the out of office message for a user. It seems to work sometimes and sometimes it does not. I have a feeling it is because of the outofofficeprofile is cached. Do I need to do anything special to let the rest of system know I have modified the file.

This is the code I use to set the out of office agent.

It should be noted that on the server, I have the out of office mode set to service instead of agent. Do I need to change the way I enable out of office?


		memo.replaceItemValue("SaveOptions","0");

		

		memo.replaceItemValue("Subject", "1");

		memo.replaceItemValue("SubjectDate", "( returning "+endDate+")" );

	memo.replaceItemValue("BookBusyTime", "1");

		memo.replaceItemValue("CurrentStatus", "1");

		memo.replaceItemValue("CurrentStatusDisplay", "On");



		memo.replaceItemValue("dateFirstDayBack",

threadSession.createDateTime(endDate +“00:00:00 CET”));

memo.replaceItemValue (“dateFirstDayOut”,

threadSession.createDateTime(startDate +“00:00:00 CET”));

memo.replaceItemValue (“FirstDayOut”,startDate);

memo.replaceItemValue (“FirstDayBack”,endDate);

		memo.replaceItemValue("DaysOut","I am out of the office until " + endDate);

		memo.replaceItemValue("daysoutdisplay","I will be out of the office starting "+startDate+" and will not return until "+endDate);

		memo.replaceItemValue("SpecialBody","I am out of the office until "+endDate);

		memo.replaceItemValue("SpecialMessage","");

		memo.replaceItemValue("showhours","");

		memo.replaceItemValue("starttime","");

		memo.replaceItemValue("endtime","");	

		

		memo.replaceItemValue("GeneralMessage","Auto set Out of office));

		

		memo.replaceItemValue("SaveOptions","1");

//i have played around with signing to no avail

memo.sign();

memo.save(true, false, false);

memo.sign();

					Agent agent = mailDB.getAgent("OutOfOffice");

agent.setEnabled(enablea);

agent.save();


Subject: gui not updating

one more thing.

When set programatically for the user, if I go to through notes via Actions-More-Out of Office, the changes I make programatically tend to have a time updating. For sure if I quite Notes and bring it up, the changes take effect.

Any ideas?

Subject: I recommend using the Notes Mail Template

The code to turn on the appropriate mechanism is pretty complex. Is there a reason why you don’t want the use Notes Mail Template?

The Notes Mail Template consults the configuration and does different things depending on that configuration.

Subject: i see the problem

Okay, I see the problem. I was enabling the agent, whereas I should be enabling the service.

//DBOPT_OUTOFOFFICEENABLED=74

mailDB.setOption(DBOPT_OUTOFOFFICEENABLED, true);

If I run this in the background, I have to restate the notes client to see the effect in the GUI.

Even after the restart, OOO does not work. I must be missed some fields being set or something.

Subject: router says ooo is enabled

tell router o09/04/2009 11:13:09 AM Out of office service is activated in the following databases:

09/04/2009 11:13:09 AM mail file: mail7 (mail\mail7.nsf)

09/04/2009 11:13:09 AM mail file: mail6 (mail\mail6.nsf)

09/04/2009 11:13:09 AM Completed scan for active Out of office service.

as I can see the ooo is being activated on the router. However when I send a mail via the client to either mail6 or mail7, I do not get an OOO message?

any ideas?

Subject: Setting a db option flag does not enable ooo functionality by itself

Just setting a database option bit does not enable the functionality. We are working on the API that would allow to manipulate this functionality programmatically, as the set of things that need to be done is rather complex.