Hello all,
I'm tryng to do a simple parsing test on a CalDav calendar...
This is my example code just used for testing
in red the console output
Anyone have suggestions?
Many Thanks
Amedeo
public void parse() throws Exception {
Protocol myHTTPS = new Protocol( "http", new
DefaultProtocolSocketFactory(), 80 );
CalDavCalendarStore store = new
CalDavCalendarStore("MacTI","calendar.confindustria.chieti.it",
8008,myHTTPS,PathResolver.ICAL_SERVER);
store.connect("amedeomantica","password".toCharArray());
ArrayList myList = store.getCollections();
System.out.println( "size= " + myList.size()); ---> Actually
outputs: size= 1
CalDavCalendarCollection collection = (CalDavCalendarCollection)
myList.get(0); --> Size is 1 so I manually put 0 just for testing
System.out.println( "collectionID= " + collection.getId() ); ----
> Actually outputs: size= 1
System.out.println( "collectionLenght= " +
collection.getEvents()); ----> Actually outputs: collectionID= /
calendars/__uids__/CFFB9113-FE25-4B47-B022-9C5CA62674DB/calendar/ and
is CORRECT
Calendar[] calendars = collection.getEvents();
System.out.println( "count= " + new NSArray(calendars).count());
----> Actually outputs 0, this is not TRUE, should be 2
if (calendars != null) {
for (int iter = 0; iter < calendars.length; iter++) {
// Display the start time of the event
System.out.println(iter);
System
.out
.println
(calendars[iter].getComponent("VEVENT").getProperty(Property.DTSTART));
}
}
}
On 27/mar/09, at 16:54, Pascal Robert wrote:
I'm playing with iCal4j-connector, and it works ok. It won't find
the calendar-home-set from the principals, but I was able to find
the events stored in my CalendarServer installation with the
following code :
import net.fortuna.ical4j.connector.ObjectNotFoundException;
import net.fortuna.ical4j.connector.ObjectStoreException;
import net.fortuna.ical4j.connector.dav.CalDavCalendarCollection;
import net.fortuna.ical4j.connector.dav.CalDavCalendarStore;
import net.fortuna.ical4j.model.Calendar;
import net.fortuna.ical4j.model.Property;
import org.apache.commons.httpclient.protocol.Protocol;
import
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory;
Protocol myHTTPS = new Protocol( "http", new
DefaultProtocolSocketFactory(), 80 );
CalDavCalendarStore store = new
CalDavCalendarStore("MacTI","localhost",8008,myHTTPS,"/calendars");
store.connect("admin","password".toCharArray());
// it only works when checking a calendar collections, the user
collections won't work
CalDavCalendarCollection collection = store.getCollection("/users/
admin/calendar/");
Calendar[] calendars = collection.getCalendars();
if (calendars != null) {
for (int iter = 0; iter < calendars.length; iter++) {
// Display the start time of the event
NSLog
.out
.appendln
(calendars
[iter].getComponent("VEVENT").getProperty(Property.DTSTART));
}
}
So for reading events, it should works fine.
Hi Amedeo,
Take a look at [1]. We use it for our calendar component and it
works pretty well.
[1]ical4j.sourceforge.net/
Cheers,
Henrique
Amedeo Mantica wrote:
Hello all,
Anyone know if there is a Library, a Class, a Framework to access
CalDAV calendars ?
I need just to read data ad display on the web, no editing
Regards
Amedeo
://www.linkedin.com/in/macti
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/amedeomailing%40insigno.it
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]