Programmatically saving a List as a Template in SharePoint 2010 -
SPList sourceList = _web.Lists["MyCustomlist"];
sourceList.SaveAsTemplate("listTemplateName.stp","MyListTemplate", "My List Template Desc", false);
sourceList.Update();
Creating a List -
SPSite siteCollection = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
SPListTemplateCollection listtempcol = web.Site.GetCustomListTemplates(web);
web.Lists.Add("MyCustomList", "This is my list using Custom List Template", listtempcol["MyListTemplate"]);
Ads by Google
No comments:
Post a Comment