In this post I'm going to share how to create new list using C#. Here is the sample code
public bool SaveList(string List,string Description,string type){try{SPSite site = new SPSite(SiteURL);SPWeb web = site.OpenWeb();web.Lists.Add(List, Description, web.ListTemplates[type]);}catch (Exception ex){MessageBox.Show("Coundn't create the new list"+ Environment.NewLine + ex.Message,"Message");return false;}return true;}
No comments:
Post a Comment