Search This Blog

Sunday, December 8, 2013

insert data into SharePoint list using c#.

insert data into SharePoint list using c#.

In this Article I will explain how to insert data into SharePoint list using c#.
I am designing a UI with all the fields in Button Click I am writing this logic.

ClientInformation is my list name,Is already created in SharePoint Site.
Once we deploy we can able to insert this data in to list.

protected void btnsubmit_Click1(object sender, EventArgs e)
{
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPList list = web.Lists["ClientInformation"];
SPListItem listitem = list.Items.Add();
listitem["ClientName"] = txtclientname.Text;
listitem["ClientLocation"] = txtclientlocation.Text;
listitem["Address"] = txtclientaddress.Text;
listitem["ContactPerson"] = txtcontactperson.Text;
listitem["Email"] = txtEmailId.Text;
listitem.Update();


}

No comments:

Post a Comment