Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How To Create An Announcement List In Sharepoint 2013 Programmatically
WhatsApp
Manpreet Singh
8y
7
k
0
0
25
Blog
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.
Keep reading & keep learning!
Sharepoint 2013
People also reading
Membership not found