Download Full Calendar and Webcal protocol

PITO Web CMS asked on February 2, 2015 23:00

Hello, I am currently in version 8.0.19 of Kentico, and was wondering if there was a way or if you could suggest me on how to create a downloadable list of events in an iCal format. To give some context of my situation: I created in my content tree a path called Events where only event documents can be stored. Then, using a repeater I show a list of upcoming events with the following structure:

<div class="row-fluid">

  <div id="iCalButton" class="span1">
    <a target="_blank" href="/CMSModules/EventManager/CMSPages/AddToOutlook.aspx?classname=custom.registrar_Calendar&amp;eventid=11840">
      <img src="/getmedia/c8850dfd-f288-4ab4-bb14-b34f28402008/AddCal.aspx" alt="Add to Calendar" title="Add to Outlook"></a>
  </div>
  <div class="span1">
    <strong> August 11 </strong>  
  </div>

  <div class="span10 leftText">
    Tuesday, Summer II term &amp; 10-week final examinations for all students.
<ul>
    <li>August 11, 2015
    <ul>
        <li><a href="/Courses,-Registration,-Scheduling/Final-Exam-Schedule#3-SummerSessionII" target="_blank">Summer II Term</a></li>
        <li><a href="/Courses,-Registration,-Scheduling/Final-Exam-Schedule#4-August11(Tuesday)" target="_blank">10-Week Semester</a></li>
    </ul>
    </li>
    <li>August 12, 2015
    <ul>
        <li><a href="/Courses,-Registration,-Scheduling/Final-Exam-Schedule#4-August12(Wednesday)" target="_blank">10-Week Semester</a></li>
    </ul>
    </li>
</ul>

  </div>

</div>

As you can see, I am able to use Add to Outlook page from CMS Modules to generate an individual calendar event. But I am unable to think on how to use a similar C# file to generate a full calendar from the path /Events. Guidance or suggestions are more than welcome. Thank you.

PS. I was also wondering if I can then change the HTTP request to a Webcal:// request so users can 'subscribe' to the event calendar. It is alright if you can't respond this.

Recent Answers


Marek Fesar answered on March 4, 2015 14:18 (last edited on March 4, 2015 14:21)

Hi,

The current AddToOutlook.aspx page does not support putting multiple vEvent items in one response. However, you can implement such functionality quite easily.

To start with, have a look at the code behind of the page (AddToOutlook.aspx.cs). Then create your own page (modifying the current one is not recommended due to possible issues during upgrade). The page will accept a query parameter specifying the node alias path from which you want to load the events. Using this path, select appropriate nodes from the content tree (you can find inspiration on how to select document nodes in http://devnet.kentico.com/articles/kentico-8-technology-documentquery-api ). Keep in mind the security aspect - do not process alias paths which would disclose anything else then public events.

Once you have the nodes, implement a method similar to GetContent method from AddToOutlook.aspx.cs. All you have to do is add multiple vEvent items in the content of the response (each is delimited by BEGIN:vEvent and END:vEvent).

Shall you need more information regarding the vEvent format, consult the following RFCs:

Regarding the webcal protocol handling, I am not really familiar with it, but I think you will have to configure a proper bining in your IIS (to respond to other than http(s) protocols).

Regards

Marek Fesar

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.