Solved

Problem creating a list programmatically using list template

Posted on 2011-09-09
3
442 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
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
chapmanjw earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
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 …
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 use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

809 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