Issue 121: Reading content from a SharePoint-list via webservice and creating new calendarentries from that
Status:  Done
Owner: ----
Closed:  Oct 2009
Reported by Christia...@gmail.com, Oct 13, 2009
Hello,

I've already got back the XML-response from the listwebservice but
how can I create calendarevents using the variables of the XML-response.

I'm using FullCalendar Version 1.3.1

The SP-list looks like that:
http://img517.imageshack.us/img517/962/sharepointlist.jpg

-title should also be the title-object of the event
-date is the start-object (not formatted yet)
-Allday is the allDay eventobject
-Creator should be shown when the user hovering an event

Thats the way I normally add an event manually

events:[ 
  {
     id: 1,
     title: "Event1",
     start: "2009-10-12T16:00:00Z",
     allDay: true
  }
]

I would be very happy about an answer.
Thanks!

Best regards

Chris





Oct 13, 2009
Project Member #1 adamrs...@gmail.com
you need to parse the XML with your own custom javascript. it needs to create an array 
of 'CalEvent' objects (http://arshaw.com/fullcalendar/docs/events-and-
sources.php#calevent)

then return this array in a function that you provide for the 'events' option
(http://arshaw.com/fullcalendar/docs/events-and-sources.php)

i cant provide any more support beyond this. i promise the website will have better 
examples in the future. also, i cannot provide any help specific to SharePoint, because 
i have never dealt with that system.

good luck.
Status: Done
Oct 5, 2011
#2 dme...@gmail.com
this is fairly simple to do using the events (as a function), and i imagine you could use the $.ajax of jQuery but i would recommend using SPServices (http://spservices.codeplex.com/).

$('#calendar').fullCalendar({
	editable: false,
	header: {
		left: 'prev today',
		center: 'title',
		right: 'month,basicWeek,agendaDay next'
	},
	events: function(start, end, callback) {
		var a = $.fullCalendar.formatDate(start,'yyyy-MM-dd');
		var b = $.fullCalendar.formatDate(end,'yyyy-MM-dd');
		$().SPServices({
			operation: 'GetListItems',
			listName: '{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}',
			CAMLQuery: '<Query><Where><And><Geq><FieldRef Name="EventDate" /><Value Type="DateTime">'+a+'</Value></Geq><Leq><FieldRef Name="EventDate" /><Value Type="DateTime">'+b+'</Value></Leq></And></Where></Query>',
			async: true,
			completefunc: function(xData,status){
				var events = [];
				$(xData.responseXML).find("[nodeName='z:row']").each(function() {
					events.push({
						title: $(this).attr('ows_Title'),
						start: $(this).attr('ows_EventDate'),
						end: $(this).attr('ows_EndDate')
					});
				});
				callback(events);
			}
		});
	}
});

this will not support reoccurring events, that's a whole other can of worms you can google. the CAMLQuery will ensure the only events grabbed are between the dates in the calendar view.