SPSRollUpCalendar

- 2 mins read

(Beta Documentation)

Included in version 2 of SPSRollUp there is a new webpart to roll up data and show it using the SharePoint calendar view.

SPSRollUpCalendar has a similar operation to the SPSRollUp and SPSRollUpChart, and this means that it tracks sites and lists collecting information, the collected data is transformed using XSLT to generate XML as SPSRollUpChart does. The result XML is a description of the events to show in a calendar view.

The XSLT must generate a collection of SPSCalendarItems

By example the output

<Rows>
  <Row>
    <_RowNumber>0</_RowNumber>
    <Title>Task in Project One</Title>
    <DueDate>2008-04-09T00:00:00Z</DueDate>
    <StartDate>2008-03-25T00:00:00Z</StartDate>
  </Row>
  <Row>
    <_RowNumber>1</_RowNumber>
    <Title>Task in Project Two</Title>
    <DueDate>2008-03-25T00:00:00Z</DueDate>
    <StartDate>2008-02-25T00:00:00Z</StartDate>
  </Row>
  <Row>
    <_RowNumber>2</_RowNumber>
    <Title>New Customers Letter</Title>
    <DueDate>2008-03-28T00:00:00Z</DueDate>
    <StartDate>2008-03-25T00:00:00Z</StartDate>
  </Row>
</Rows>

Important Note: The dates in results are in ISO format.

is transformed using the next XSLT

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:sps="http://schemas.spsprofessional.com/WebParts/SPSXSLT">
  <xsl:output method="xml" indent="yes" />
  <xsl:template match="@* | node()">
    <!-- Graph -->
    <SPSCalendar>
      <xsl:apply-templates />
    </SPSCalendar>
  </xsl:template>
  <!-- Each row -->
  <xsl:template match="Row">
    <!-- Put here your fields -->
    <SPSCalendarItem StartDate="{StartDate}" EndDate="{DueDate}" Title="{Title}" />
  </xsl:template>
</xsl:stylesheet>

And the final result is the next XML that is a calendar definition

<SPSCalendar xmlns:sps="http://schemas.spsprofessional.com/WebParts/SPSXSLT">
  <SPSCalendarItem StartDate="2008-03-25T00:00:00Z" 
                   EndDate="2008-04-09T00:00:00Z" Title="Task in Project One" />
  <SPSCalendarItem StartDate="2008-02-25T00:00:00Z" 
                   EndDate="2008-03-25T00:00:00Z" Title="Task in Project Two" />
  <SPSCalendarItem StartDate="2008-03-25T00:00:00Z" 
                   EndDate="2008-03-28T00:00:00Z" Title="New Customers Letter" />
</SPSCalendar>

Which render view is

SPSCalendarItem Attributes

  • BackgroundColorClassName – The background color class name.
  • CalendarType – The calendar type.
  • Description – String that represents the description of the calendar item.
  • Direction – String value that represents the reading direction of the calendar item.
  • DisplayFormUrl – String value that represents the display form URL of the calendar item.
  • EndDate – The date time value that represents the end date of the calendar item.
  • hasEndDate – Boolean value that indicates whether the calendar item has an end date.
  • IsAllDayEvent – Boolean value that indicates whether the calendar item is an all-day event.
  • IsRecurrence - Boolean value that indicates the recurrence of the calendar item.
  • IsRecurrenceException – Boolean that indicates whether this is an exception to a recurring calendar event.
  • ItemID – String value that represents the ID of the calendar item.
  • Location – String value that represents the location of the calendar item.
  • StartDate – The date/time value that represents the start date of the calendar item.
  • Title – String value that indicates the title of the calendar item.