C# Corner
Tech
News
Videos
Forums
Trainings
Books
Live
More
Interviews
Events
Jobs
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
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
Create A List Item In SharePoint Using CSOM(Announcement List)
WhatsApp
Gowtham Rajamanickam
9y
43
k
0
1
25
Blog
Steps
Open Visual Studio in your system
Select Console Application template and give the name "Enablefolder"
Add a Microsoft.Cleint Assembly reference file in right side reference tab in Visual Studio.
Replace Program.cs with the source code given below.
using
System;
using
Microsoft.SharePoint.Client;
namespace
GowthamArticles
{
class
CreateListItem
{
static
void
Main()
{
ClientContext clientContext =
new
ClientContext(
"https://gowtham.sharepoint.com/tutorials"
);
List oList = clientContext.Web.Lists.GetByTitle(
"Announcements"
);
ListItemCreationInformation itemCreateInfo =
new
ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);
oListItem[
"Title"
] =
"Test Item!"
;
oListItem[
"Body"
] =
"This sample item created programmatically"
;
oListItem.Update();
clientContext.ExecuteQuery();
}
}
}
Thanks for reading this blog.
People also reading
Membership not found