I want to add event to public Calendars using Apex code in trigger. Currently I have hardcoded id of public Calendar in my code. But I don't want to hardcode id of Calendars. I want to query it in my code. But I am not able to query it as it says sObject type 'Calendar' is not supported.

Any help is appreciated.

Thanks Ankush

  • Can anyone please suggest me how to query salesforce Calendar object – Ankush Dureja Oct 12 '14 at 18:33

I have run into this as well. I am having trouble finding a link to post (I will keep searching), but our workaround is a custom object with a Calendar_Id__c field because we need lookups to this object, otherwise you could use a custom setting to store the names.

Inelegant, perhaps, but you can retrieve them programmatically as you desire.


From what I've read and tried, this is currently not possible. Sad, but that's how it is.

  • Maybe you could provide some links to what you have read saying this is not possible. – Chris Duncombe Jan 7 '15 at 15:10

You can access it finally in API Version 45 - Select Id,Name From Calendar Where Type='Resource'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.