[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Problem creating a list programmatically using list template

Posted on 2011-09-09
3
Medium Priority
?
449 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

650 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