?
Solved

Problem creating a list programmatically using list template

Posted on 2011-09-09
3
Medium Priority
?
447 Views
Last Modified: 2012-06-22
I am creating a list programmatically using a custom list template called 'Our Meeting Rooms'. When I try to retrieve the list template using the following line of code it raises the exception that 'vale does not fall within the expected range'.

SPListTemplate listTemplate=   web.ListTemplates ["Our Meeting Rooms"];

I can create a list through UI in SharePoint using the same template but for some reason it ican't be used in program.
Any suggestions please??
0
Comment
Question by:shieldguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
chapmanjw earned 2000 total points
ID: 36514888
You could look at the Site List Templates gallery on the site collection to get the GUID of your custom list definition.  Then use the GUID instead of the name when referencing the template.
0
 
LVL 1

Author Comment

by:shieldguy
ID: 36516181
That's what I initially thought to retrieve the list template using GUID but web.ListTemplates doesn't accept GUID but only the list template name. Is there any way we can retrieve list template using template GUID.

SPListTemplate listTemplate = web.ListTemplates["ListTemplateName"];
0
 
LVL 1

Author Comment

by:shieldguy
ID: 36521557
Can anyone help please?
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question