SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create custom calendar list programatically.

SPListTemplate template = web.ListTemplates["Calendar"];
var newListID = web.Lists.Add(fromTitle, description, template);

But i cannot do this because of out of range exception! Calendar template cannot be found!

But when site is created i can see Calendar template in list of templates!

Also those two features is activated before my code

public Guid GroupWorkLists = new Guid("9c03e124-eef7-4dc6-b5eb-86ccd207cb87");

public Guid TeamCollaborationLists = new Guid("00bfea71-4ea5-48d4-a4ad-7ea5c011abe5");

What i am doing wrong and why i cannot get calendar list template?

share|improve this question
up vote 2 down vote accepted

Try web.ListTemplates["Events"] or web.ListTemplates[106].

SPListTemplateType enumeration

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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