This project is read-only.

How to READ a simple event?
using WindStyle.SPCalendar;
var regionalSettings = SPContext.Current.RegionalSettings;
var evt = Event.ParseEvent(item, regionalSettings);
var location =  evt.Location;
var start = evt.Start;
var end = evt.End;
var description = evt.Description;

How to READ a repeat event?
var evt = Event.ParseEvent(item, regionalSettings) as Event<Pattern.YearlyByDayPattern>;
var month = evt.Recurrence.Pattern.Month;
var ordinal = evt.Recurrence.Pattern.Ordinal;
var days = evt.Recurrence.Pattern.Days;
var repeatInstance = evt.Recurrence.DateRange.End.Instances;

How to Know the exact type of an Event?
Event.EventType property indicates that, you can convert the event into correct type according to that property.
var evt = Event.ParseEvent(item, regionalSettings);
If(evt.EventType == EventType.YearlyByDay)
    var realEvent = evt as Event<Pattern.YearlyByDayPattern>;

How to create or update a event?
Just simply get the Event object, update the properties, then call Event.ApplyEvent to apply all the properties to a SPListItem.
var evt = new Event<Pattern.DailyByFrequencyPattern>();
evt.Title = "SharePoint Calendar Helper Demo";
evt.Recurrence.Pattern.Frequency = 2;
Event.ApplyEvent(evt, calendarItem, regionalSettings);

Last edited Jun 28, 2013 at 9:41 AM by xiaoshatian, version 6


No comments yet.