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
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Create a list in SharePoint Programatically using C#
WhatsApp
Gowtham Rajamanickam
9y
16.4
k
0
1
25
Blog
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.
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
;
}
}
Up Next
Create A List Item In SharePoint Using CSOM(Announcement List)
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