Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How To Create A Custom List In SharePoint 2013 Programmatically
WhatsApp
Manpreet Singh
8y
11.9
k
0
0
25
Blog
Hello Readers,
Welcome to a blog on how to create a custom list in SharePoint 2013 programmatically, using a Console Application. We will use Visual Studio to create a list in SharePoint 2013.
Let’s see, how to do it.
Open your Visual Studio.
Select New Project.
Select Console Application.
Add the references, which are:
Microsoft.SharePoint dll and Microsoft.SharePoint.Client dll.
Paste the code, given below, under Program.cs.
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Net;
using System.Text;
using System.Web;
using System.Data;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
namespace ConsoleApplication1 {
class
Program {
static
void
Main(string[] args) {
//get the web
ClientContext context =
new
ClientContext(
"http://devtest /SPTests/"
);
Web web = context.Web;
//provide the list creation information as Title and Description
ListCreationInformation createlist =
new
ListCreationInformation();
createlist.Title =
"My List"
;
createlist.Description =
"My Custom List"
;
//choose a template as Generic List.
createlist.TemplateType = (
int
) ListTemplateType.GenericList;
//add list to SharePoint
web.Lists.Add(createlist);
context.ExecuteQuery();
Console.WriteLine(
"List Created"
);
Console.ReadKey();
}
}
}
Run the code and your custom list will be created.
Create A Custom List
Sharepoint
Sharepoint 2013 Programmatically
Up Next
Create List from Custom List Template Programmatically in SharePoint
Ebook Download
View all
Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS
Read by 4.9k people
Download Now!
Learn
View all
Membership not found