Creating Meeting lotus Meeting using ICall - java

In a eclipse plugin for the Lotus Notes client I need to create a meeting in a user's mailfile. I have created successfully an appointment in my own mailfile using the NotesCalendar object. (see code below ). What I don't seem to get right is to create a meeting instead of an appointment. On the database level the difference is made by a field called appointmenttype which is set to 3 in the case of a meeting and 0 in the case of a appointment.
According to resources I found I need to add the xProperty "X-LOTUS-APPTTYPE" with a value of "3" to my Ical4j object but for some reason this is not being processed by the NotesCalendar.createEntry() method.
Does someone have any idea how to create a Meeting in a mailfile using the NotesCalendar notes classes and Ical4j?
(the reason I have added the xPages tag is that I hope someone in the xPages community ever has used the notescalendar objects before )
Code that creates an appointment:
DateTime meetingStart = new DateTime(c.getStartTime().getTime());
DateTime meetingEnd = new DateTime(c.getEndTime().getTime());
VEvent meeting = new VEvent(meetingStart, meetingEnd, c.getSubject());
// Add chair
Attendee chairAttendee = new Attendee(URI.create("mailto:j.somhorst#development.acuity.nl"));
chairAttendee.getParameters().add(Role.CHAIR);
// Add invitees
for(User invitee : c.getUserParticipants()){
Attendee attendee = new Attendee(URI.create("mailto:"+invitee.getEmail()));
attendee.getParameters().add(Role.REQ_PARTICIPANT);
meeting.getProperties().add(attendee);
}
// create calendar for ics export
Calendar call = new Calendar();
call.getProperties().add(new ProdId("-//Lotus Development Corporation//NONSGML Notes 9.0.1//EN_API_C"));
call.getComponents().add(meeting);
// notes specific fields
meeting.getProperties().add(new XProperty("X-LOTUS-NOTESVERSION","2"));
meeting.getProperties().add(new XProperty("X-LOTUS-APPTTYPE","3"));
NotesCalendar notesCalendar = NotesUtil.getNotesCalendar(s);
if(notesCalendar!=null){
notesCalendar.setAutoSendNotices(false);
NotesCalendarEntry entry = notesCalendar.createEntry(call.toString());
String icallvalue = entry.read();
System.out.println(icallvalue);
}

Related

How to get shared calendar list using caldav4j from davical?

I created my own calendar using netbeans, caldav4j and Davical. However, I can't get shared calendar list.
I can create a calendar or an event. I can see them at Agendav. But when I share calendar to other users at Agendav, I can't get it with my netbeans code.
I want to show which user shared calendar with me.
HttpClient http = createHttpClient();
HostConfiguration hostConfig = createHostConfiguration();
PropFindMethod propfind = new PropFindMethod();
propfind.setPath(caldavCredential.home);
PropProperty propFindTag = PropertyFactory.createProperty(PropertyFactory.PROPFIND);
PropProperty aclTag = PropertyFactory.createProperty(PropertyFactory.ACL);
PropProperty propTag = new PropProperty(CalDAVConstants.NS_DAV,"D","prop");
propTag.addChild(aclTag);
propFindTag.addChild(propTag);
propfind.setPropFindRequest(propFindTag);
propfind.setDepth(0);
executeMethod(hostConfig, propfind);
Set<String> keySet = (propfind.getResponseHashtable()).keySet();
for(String key: keySet){
CalDAVResponse response = (propfind.getResponseHashtable()).get(key);
String href = response.getHref();
Ace[] aces = propfind.getAces(href);
Enumeration enumerations = aces.enumeratePriviliges();
while(enumerations.hasMoreElements()){
Privilege privilege = (Privilege)enumerations.nextElement();
System.out.println("parameter: " + privilege.getParameter());
}
}
I try to get privileges but there is no parameter. I only want which user shared calendars with me. I can make calendar, add event but I can't access shared calendar list.

Events from database show to google calendar

I am developing an app, which works like a booking system. The main-component is a calendar which shows created events, which are stored in PostgreSQL database. My challenge now, is to show all the events from database to the adminĀ“s google calendar. When the admin opens his google calendar, he only has rights to see the events, but not to edit them.
The technologies i am using is Apache/Tomcat, Java, Spring and Hibernate.
Can someone help me, or guide me to some clear solution?
If you are looking for guide, then the documentation can help you a lot.
First thing, you need to understand the concept of Google Calendar API. You can read the basic concept on the overview page for further details. Moreover, if your aim is just more on the events, then you will need to make sure that you have visited this.
Here is a sample snippet all the way from the sample given in the documentation. This sample demonstrate creating an event and setting its metadata:
// Refer to the Java quickstart on how to setup the environment:
// https://developers.google.com/calendar/quickstart/java
// Change the scope to CalendarScopes.CALENDAR and delete any stored
// credentials.
Event event = new Event()
.setSummary("Google I/O 2015")
.setLocation("800 Howard St., San Francisco, CA 94103")
.setDescription("A chance to hear more about Google's developer products.");
DateTime startDateTime = new DateTime("2015-05-28T09:00:00-07:00");
EventDateTime start = new EventDateTime()
.setDateTime(startDateTime)
.setTimeZone("America/Los_Angeles");
event.setStart(start);
DateTime endDateTime = new DateTime("2015-05-28T17:00:00-07:00");
EventDateTime end = new EventDateTime()
.setDateTime(endDateTime)
.setTimeZone("America/Los_Angeles");
event.setEnd(end);
String[] recurrence = new String[] {"RRULE:FREQ=DAILY;COUNT=2"};
event.setRecurrence(Arrays.asList(recurrence));
EventAttendee[] attendees = new EventAttendee[] {
new EventAttendee().setEmail("lpage#example.com"),
new EventAttendee().setEmail("sbrin#example.com"),
};
event.setAttendees(Arrays.asList(attendees));
EventReminder[] reminderOverrides = new EventReminder[] {
new EventReminder().setMethod("email").setMinutes(24 * 60),
new EventReminder().setMethod("popup").setMinutes(10),
};
Event.Reminders reminders = new Event.Reminders()
.setUseDefault(false)
.setOverrides(Arrays.asList(reminderOverrides));
event.setReminders(reminders);
String calendarId = "primary";
event = service.events().insert(calendarId, event).execute();
System.out.printf("Event created: %s\n", event.getHtmlLink());

EWS Java get meetings

I am trying to integrate exchange calendar with my custom calendar. Till now i am able to integrate new creation of meeting from my calendar to Exchange.
But the issue i am facing is from Exchange to my calendar. If i create a new meeting in outlook, and and if i search it through below code i am getting results.
<code>
CalendarFolder calendarFolder = CalendarFolder.bind(eService, WellKnownFolderName.Calendar);
CalendarView calendarView = new CalendarView(startOfMonth.toDate(), endOfMonth.toDate());
FindItemsResults<Appointment> aprilMeetings = alendarFolder.findAppointments(calendarView);
</code>
in above list i am getting all meetings between start and end date. My question is how to identify whether its a new meeting or updated meeting or canceled meeting.
I tried these methods,
<code>
appointment.getIsNew().
appointment.getIsCancelled()
appointment.getIsUnmodified()
</code>
But all above methods return false. I need to find a way to figure out this so that i can sync items from my Exchange Server to my custom application (Note: I am also creating iCal file in my application, so i can use my application when exchange is not connected).
Regards.
you can use the following code to get updated/new meetings.
Date startDate1 = formatter.parse("2014-04-25 07:00:00");
SearchFilter filter = new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.LastModifiedTime,startDate1);
FindItemsResults<Item> findResults = exchange.findItems(WellKnownFolderName.Calendar, filter, new ItemView(10));
for (Item item : findResults.getItems())
{
Appointment appt = (Appointment)item;
System.out.println("SUBJECT====="+appt.getSubject());
System.out.println("Location========"+appt.getLocation());
System.out.println("Start Time========"+appt.getStart());
System.out.println("End Time========"+appt.getEnd());
System.out.println("Email Address========"+ appt.getOrganizer().getAddress());
System.out.println("Last Modified Time========"+appt.getLastModifiedTime());
}

how to create a lotus notes meeting using java in domino designer

Hi i am trying to create meeting in lotus notes using java.i am able to send a meeting invite to the recipients.But when i send a meeting the options available to the chair and the recipients are the same.(options like accept,decline).But the options for the chair and the recipients should be different.can anyone please tell how to do this?
public DocumentKey save(final Session session, final Database db, boolean send,
String moveToFolder) throws NotesException, Io Exception {
//setBody(null);
Document doc = null;
RichTextItem rti = null;
try {
doc = db.createDocument();
db.getView(ServiceConstants.MEETINGS);
// Here i am setting all the properties for that document.
// I cant post that code as it has
// over 100 properties, so more than 100 lines of code
rti = doc.createRichTextItem(ServiceConstants.BODY);
rti.appendText(getBody());
if ((attachment != null) && (attachment.length > 0)) {
for (int i = 0; i < attachment.length; i++) {
attachment[i].save(rti);
}
}
doc.save(true, true, true);
if (send) {
doc.send();
}
if (!isBlank(moveToFolder)) {
doc.putInFolder(moveToFolder, true);
}
setKey(new DocumentKey(doc.getNoteID()));
} finally {
Helper.cleanupIfNeeded(rti);
Helper.cleanupIfNeeded(doc);
}
return getKey();
}
To successfully schedule a meeting, you need to follow the calendaring and scheduling schema
In short: A meeting has to be created in the chair's mail file and the invitations have to be responses (doc.MakeResponse(...)) to that main document and sent via mail. The "ApptUnid"- item ties them all together.
Read the documentation in the link, it is very good
If you are using Notes / Domino 9.0 or greater, you should consider using the lotus.domino.NotesCalendar interface and its related interfaces. These relatively new interfaces let you create, read and update calendar entries using iCalendar format.
Here's some sample code:
// Get the NotesCalendar object from the database
NotesCalendar notesCalendar = session.getCalendar(database);
if ( notesCalendar == null ) {
throw new Exception("Cannot open calendar.");
}
// Create a meeting in iCalendar format
String ical = iCalendarMeeting();
// Create the meeting on the Notes calendar
NotesCalendarEntry entry = notesCalendar.createEntry(ical);
This code creates an instance of NotesCalendar from an instance of Database. Then it gets the representation of a meeting in iCalendar format (the iCalendarMeeting method is not shown). Finally, it calls NotesCalendar.createEntry() to create the meeting. The createEntry method places the meeting on the organizer's calender and sends an invitation to all attendees.

Choose Non-default googlecalendar with google-java-client-api

I want to get all the Calendars, which are in my GoogleAccount, using the google java client API.
In my application I want that a user can choose in wich calendar his events will be saved (not only in the default). But therefore I need their CalendarIDs. I don't want that the users have to search their calendar ids to write them by hand into the app.
Would it be possible to create a new Calendar in his account, to write all the events in this new one.
Sorry for my bad English.
Yes of course it is possible.You only have to know the calendarId in which you want to save the new event, and use them with the event insert function.
For example :
Event event = new Event();
event.setSummary("This is my Event");
event.setLocation("127.0.0.1 -- Home sweet Home!!");
ArrayList<EventAttendee> participants = new ArrayList<EventAttendee>();
participants .add(new EventAttendee().setEmail("member#domain.com"));
event.setAttendees(participants);
DateTime start = new DateTime(new Date(), TimeZone.getTimeZone("UTC"));
event.setStart(new EventDateTime().setDateTime(start));
DateTime end = new DateTime(new Date(startDate.getTime() + 3600000), TimeZone.getTimeZone("UTC"));
event.setEnd(new EventDateTime().setDateTime(end));
Event createdEvent = service.events().insert("YourCalendarID", event).execute();
Hope this could help you!

Categories

Resources