Solved

Problem creating a list programmatically using list template

Posted on 2011-09-09
3
441 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

Suggested Solutions

Title # Comments Views Activity
Disable Checkout in SharePoint 2010 3 59
server program files 24 63
Sharepoint User Name Displaying incorrectly. 17 41
Sharepoint 2010 2 11
The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
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…

832 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