I've found this article detailing how to create a list in code based on a list template. I'm trying to create a user control that would go on a master page that is shared across all site collections. This user control will have a dependency on several lists, so I want to add them to my project and in the Feature's Event Receiver (FeatureActivated method), check to see if the list is created. If not, create it (for each list). But I would like to have the list template be part of the project (and not out on the site collection) and reference it with my code.
What I would like to do is this:
SPSite siteCollection = SPContext.Current.Site; SPWeb mySite = SPContext.Current.Web; SPListTemplateCollection listTemplates = //get a reference to my template here - this is not in the site collection, but in my project; SPListTemplate listTemplate = listTemplates["Custom List Template"]; mySite.Lists.Add("Custom List", "A list created from a custom list template in my project", listTemplate);
Is something like this possible? Practical?