Solved

Problem creating a list programmatically using list template

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
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 …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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 …

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now