function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Public calendar on Visualforce page?

Is it possible to add public calendar to visual forca page with some standard controller and ID?


Click to "change button" is very uncomfortable way and I want to just show visualforce page with one click tab.


If you have a public calendar already configured in your org, you could add an iframe to a VF page and reference the URL of the public calendar.  Then associate the VF with a

  • site page or a
  • VF tab if you prefer. 

here's an example of the VF:

<apex:page showHeader="0" >
  <apex:iframe height="800" src=""/>

This page will only be accessible by folks who can login to though if displayed on a public sites page...  I'm wondering if anyone has a trick for exposing the public calendar via sites pages to non users.  Use case: expose a public calendar hosten in to the intranet for all employees to access.


I have achieved the public calendar as below..

vf page:


<apex:page controller="CalendarController" action="/00U/c?cType=1&cal_lkid={!calendarId}&md0={!YEAR(TODAY())}&md1={!MONTH(TODAY())-1}">
Please wait...


apex class:


public with sharing class CalendarController {
public String calendarId {get; set; }

public CalendarController () {
calendarId = CalendarsList__c.getValues('PubCalendar').CalID__c;


CalendarsList is the public custom setting of List type with the field CalID__c which holds the ID of the public calendar..


let me know if you need additional details..thanks

It doesn't seems to be working.


I have created same code of VF Page:


<apex:page controller="CalendarController" action="/00U/c?cType=1&cal_lkid={!calendarId}&md0={!YEAR(TODAY())}&md1={!MONTH(TODAY())-1}">
Please wait...


Then Controller:


public with sharing class CalendarController {
public String calendarId {get; set; }

public CalendarController () {
calendarId = Calender__c.getValues('PubCalendar').CalID__c;


In controller I have created Custom Setting as Calender__c and custom field as CallD__c, but there seems to be some issue it is not executing.

I am geeting the error below:

Error: CalendarController Compile Error: Illegal assignment from Decimal to String at line 5 column 1


Please suggest...


did you create the Custom Setttings under Develop-> Custom Settings (List)

Label: Calendar

API Name: Calendar__c

calId__c is the Text field which holds the public calendarId.


hope you have created the public calender under Customize->Activitites->Public Calendars and Resources. Need to capture the calendar ID and insert this as a record in above Custom Settings List.

Name: PubCalendar

CalID__c: your calendar Id value


If above things are setup properly then it should work. let me know if you still face any issues
Can you please send some Screen shots to make it easy ?

there is a typo in apex class...

calendar__c..did you fix it?


This worked perfect for me after adding the apex class and custom setting. A big thanks to clouduser.


Thanks jtb226....If my solution was helpful, please mark it as a solution. This will make it available to others as a proper answer. If you felt that I went above and beyond please give me Kudos by clicking on on the star icon.

I have tried the exact same code and setup the custom setting as well. But when I try accessing this new VF page from my Salesforce site, I get authorization required error. I have included the VF in the pages allowed by the site and also made sure that the site user has access to both the VF page and Apex controller. I setup the debug log as well but don't see any error details in there either. Can someone please help!
@skhalid Did you figured out the error? iam getting same error