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
Create A List Item In SharePoint Using CSOM(Announcement List)
WhatsApp
Gowtham Rajamanickam
8y
42.1
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.
SharePoint
CSOM
Up Next
Update A List Item In SharePoint Using CSOM (Announcement List)
Ebook Download
View all
SharePoint Framework (SPFx) A Developers Guide
Read by 11.1k people
Download Now!
Learn
View all
Membership not found