1

Anyone know what a calendar item with an eventtype of 5 means? I think its to do with specific instances of a recurring event but am not sure and can't seem to find a definitive list anywhere that includes this particular one?

3 Answers 3

2

I have seen this event type value when using the expand recurrence option in a CAML query. Each occurrence in the series, except series exceptions or deletions, will have an EventType value of 5.

Sample code:

SPList list = SPContext.Current.Web.Lists["Calendar"];
SPQuery query = new SPQuery();
query.ExpandRecurrence = true;
query.Query = string.Concat(
    "<Where>",
        "<DateRangesOverlap>",
            "<FieldRef Name=\"EventDate\"/>",
            "<FieldRef Name=\"EndDate\"/>",
            "<FieldRef Name=\"RecurrenceID\"/>",
            "<Value Type=\"DateTime\">[Today]</Value>",
        "</DateRangesOverlap>",
    "</Where>");
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem item in items)
{
    // This value should be 5 for items that are expanded from a recurring series
    // and are not exceptions to the series.  Any exceptions to the series should
    // have an event type value of 4.
    int eventType = (int)item["EventType"];
}
1

Are you sure that the EventType is 5 and that this has been setup by SharePoint - rather than modifed by non OOTB code?

I've only ever see EventTypes of 0-4 as detailed here - and I've done a lot of work with recurring events.

If it showing 5 can you detail the recurrence pattern and any exceptions (deleted/modified) instances so that we can try to reproduce the problem.

1

More info on Calendar lists in SharePoint @ https://aspnetguru.wordpress.com/2007/06/01/understanding-the-sharepoint-calendar-and-how-to-export-it-to-ical-format/

1
  • 2
    in the future, it is always best to offer a summary rather than only offering a link as an answer (because links can break and then the answer becomes useless)
    – hoffie4
    Commented Jun 15, 2016 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.