Click here to Skip to main content
15,741,215 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I can create lists and views in share point 2010.But I can't insert data in to share point list using .NET.How can I solve this?
Kannan Karthikeyan 27-Feb-12 14:15pm    
Are you getting any exception when updating a list via your .NET app. If yes, can you post the exeption details, it will really help to provide proper solution to your issue.
kingsa 12-Dec-13 4:44am    
which object Model are u using it means client or server

create sharepoint project in visual studio.
and use following code.. this might help.

SPsite site = new SPsite("") ;
site.AllowUnSafeUpdate = true ;
SPWeb web = site.OpenWeb() ;
SPList list = web.getList("YourListName");
SPListItem item = list.items.add() ;
item["itemproperty"] = "your value" ;
item["itemproperty1"] = "your value 1" ;
item.update() ;
site.AllowUnSafeUpdate = false ;
Share this answer
item["JoiningDate"] = Convert.ToDateTime("10/30/1998");
Share this answer
CHill60 19-Nov-13 18:52pm    
The word in the OP post was "data" not "date".
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;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900