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
Add a New Item in SharePoint List using C#
WhatsApp
Jacob Robinson
Jul 10
2015
1.1
k
0
0
// Open your SPSite
using
(SPSite oSite =
new
SPSite(
"http://ils-jacobr:35526"
)) {
//Get a Root Web
using
(SPWeb oWeb = oSite.RootWeb) {
//Get a Particular List
SPList oList = oWeb.Lists[
"EmployeeDetails"
];
//Add a New item
SPListItem oSPListItem = oList.Items.Add();
oSPListItem[
"Employee ID"
] = txtEmployeeId.Text;
oSPListItem[
"City"
] = txtCity.Text;
oSPListItem[
"State"
] = txtState.Text;
oSPListItem[
"First Name"
] = txtFirstName.Text;
oSPListItem[
"Last Name"
] = txtLastName.Text;
oSPListItem.Update();
}
}
SharePoint
C#
Add a New Item in SharePoint List
Up Next
Add a New Item in SharePoint List using C#