Welcome to a blog on how to create an announcement 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 you Visual Studio
- Select New Project

- Select Console Application.
- Add the references
Microsoft.SharePoint dll and Microsoft.SharePoint.Client dll - Paste the code 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 = "Announcements";
- createlist.Description = "My Custom Announcements";
- //choose a template as Generic List.
- createlist.TemplateType = (int)ListTemplateType.Announcements;
- //add list to SharePoint
- web.Lists.Add(createlist);
- context.ExecuteQuery();
- Console.WriteLine("Announcements List Created");
- Console.ReadKey();
- }
- }
- }
- Run the code and your custom announcement list will be created.

Tarun DPosted Aug 22, 2016, 12:24 AM
Thanks for sharing..