The example in this topic shows how to Create a List in SharePoint using CSOM
Please follow the steps to execute the code in visual studio using Console Application
How to create the project
- Open your Visual Studio.
- From the template select Console Application as shown in the screenshot and click next.
- Enter name and select the location to store the project and click create as shown in the screenshot.
- Now your program. cs file will open, write/copy, paste the below-given code.

using Microsoft.SharePoint.Client;
namespace CSOMCRUD
{
class Program
{
static void Main(string[] args)
{
try
{
using(ClientContext clientContext = new ClientContext("SiteURL"))
{
Web web = clientContext.Web;
ListCreationInformation listCreationInformation = new ListCreationInformation();
// Add Title of the
List
listCreationInformation.Title = "EmployeeList";
// Select the Template type of the list
listCreationInformation.TemplateType = (int)ListTemplateType.GenericList;
// Add list in the List creation information
web.Lists.Add(listCreationInformation);
// Execute the query
clientContext.ExecuteQuery();
}
}
catch (Exception ex)
{
throw;
}
}
}
}
Thank You for reading. Hope you have enjoyed this! :-)
Nice , blog
ReplyDeleteThanks
DeleteGood
ReplyDeleteThanks
Delete