- public void createList()
- {
- using (SPSite osite = new SPSite("http://Enter url sharepoint site url"))
- {
- osite.AllowUnsafeUpdates = true;
- using (SPWeb oweb= osite.OpenWeb())
- {
- oweb.AllowUnsafeUpdates = true;
- // create new Generic list called "My List"
- oweb.Lists.Add("List Name", "Description", SPListTemplateType.GenericList);
- // create Text type new column called "My Column"
- SPList list = oweb.Lists["List Name"];
- list.Fields.Add("My Column", SPFieldType.Text, true);
- oSPWeb.AllowUnsafeUpdates = false;
- }
- oSPsite.AllowUnsafeUpdates = false;
- }
- }
Create a list in SharePoint Programatically using C#
In this blog I'm going to discuss how we can create a SharePoint list pro grammatically in c# and how we can add columns to the created list.
Actually this is very simple task; this is a sample code.call the below function in your code or try with a console application in vs 2010/2012.


Gowtham RajamanickamTOP 100Posted Mar 18, 2015, 9:11 AM EDT
thank u so much Vijay..
Vijay SPosted Mar 18, 2015, 1:56 AM EDT
Nice article