SP CALENDAR PRO

A lightweight SharePoint JavaScript library to easily manage calendar events.

Features

Get Recurring Events

Easily retrieve recurring events from a SharePoint calendar, without the need to set up a CAML query.

Filter Calendar Events

Built in methods help to filter events that match user defined search criteria.

Easy To Use

Just define the data you want to retrieve, then use a callback function to filter the results.

Syntax

spcalpro.getCalendarEvents({
    listName: "StaffSchedule"
}).ready(function(data, obj) {
    if (obj.error) console.error(obj.error);
    console.table(data);
});
            

Documentation

Core

These methods are the real hero of this library- define how SharePoint calendar and list data are collected.

Utilities

Helpful functions that facilitate how users define the datetimes to be referenced when filtering.

Calendar Filters

Calendar events can be filtered based on provided dates, date ranges, or from user forms.

Demo

The code below will:

  1. Asynchronously collect all events (single and recurring) from the StaffSchedule calendar list, which is located at the /SiteColl/CalendarSubSite subsite.
  2. Convert user provided datetime information from a SharePoint form into proper date objects for use. The 0,1 parameters specify which datetime field elements on a form are to be converted.
  3. Return only the events that have a title of "Homer Simpson".
  4. Compare the returned calendar events to see if any pose a time conflict between the dates of March 1, 2019 and April 1, 2019.
spcalpro.getCalendarEvents({
    listName: "StaffSchedule",
    fields: ["Status", "Profession", "Address"],
    where: "Title = Homer Simpson",
    sourceSite: "/SiteColl/CalendarSubSite"
}).ready(function(data, obj) {
    if (obj.error) console.error( obj.error );

    var homerJSimpson = obj.isTimeConflict("2019-03-01 00:00:00", "2019-04-01 00:00:00");
    console.table( homerJSimpson );
});

Usage

View On GitHub