TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Add a New Item in SharePoint List using C#
Jacob Robinson
Jul 10
2015
Code
1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
// 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