Hi,
I’m trying to create an appointment from a remote Java application. I think this should be very easy, but I’m finding it hard going. I have eventually got to the point where I can create the appointment, and I can see it in the Notes calendar, but when I try to open it I get the message:
“Error trying to open document: Note item not found”
The appointment then opens OK, and if I save it again, this document seems to be OK, but obviously I don’t want the error message.
My code looks like this:
Session s = NotesFactory.createSession(“dominovm:63148”, “Trip Tucker/northgate-is”, “trip1234”);
DbDirectory dbDir = s.getDbDirectory(null);
Database db = dbDir.openMailDatabase();
Document doc = db.createDocument();
doc.appendItemValue(“Form”, “Appointment”);
doc.appendItemValue(“Subject”, “Created from Java19”);
doc.appendItemValue(“AppointmentType”, “0”);
doc.appendItemValue(“StartDate”, s.createDateTime(“17/06/2005”));
doc.appendItemValue(“EndDate”, s.createDateTime(“17/06/2005”));
doc.appendItemValue(“StartTime”, s.createDateTime(“09:00:00 AM”));
doc.appendItemValue(“EndTime”, s.createDateTime(“10:00:00 AM”));
doc.appendItemValue(“StartDateTime”, s.createDateTime(new GregorianCalendar(2005, 5, 17, 9, 0)));
doc.appendItemValue(“EndDateTime”, s.createDateTime(new GregorianCalendar(2005, 5, 17, 10, 0)));
doc.appendItemValue(“CalendarDateTime”, s.createDateTime(new GregorianCalendar(2005, 5, 17, 9, 0)));
doc.replaceItemValue(“$MessageType”, “Not a Draft”);
doc.replaceItemValue(“$PublicAccess”, “1”);
doc.replaceItemValue(“_ViewIcon”, new Integer(160));
doc.save(true, true);
(This is pretty much based on other code I have found lurking in the forums.)
I guess I must be missing an item or two to make it work properly, but I haven’t a clue which ones. Could someone please help?!
Thanks,
Phil