Saturday, February 26, 2011

Create all SharePoint List's Template Automatically

SPWeb web = workflowProperties.Web;
string[] listnames = (from SPList lst in web.Lists
                        select lst.Title).ToArray();

foreach (string s in listnames)
{
    web.Lists[s].SaveAsTemplate(s, s, string.Empty, false);
}