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();