Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to create a new windows application to add items in list in share point site
In my application i wanna export data from excel and need to paste that data in sharepoint site.
How this possible?
How can i add items in list using C# progarm ( Windows application ).
Posted
Updated 6-Nov-13 0:41am
v2
Comments
Raajkumar.b 6-Nov-13 5:44am    
refer this link

http://msdn.microsoft.com/en-us/library/ee539976(v=office.14).aspx
Am Gayathri 6-Nov-13 9:09am    
Thank u
ZurdoDev 6-Nov-13 8:48am    
Start by looking into the SDKs for the various programs you want to interface with.
Am Gayathri 6-Nov-13 9:09am    
Thanks

1 solution

private void button1_Click(object sender, EventArgs e)
{
try
{
string siteUrl = "Site URL";
string strname = textBox1.Text;
int intage = Convert.ToInt32(textBox2.Text);

ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Test_C#");

ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);
oListItem["Title"] = "Test";
oListItem["Name"] = strname;
oListItem["Age"] = intage;

oListItem.Update();


clientContext.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
clientContext.ExecuteQuery();
MessageBox.Show("Item Added", "SharePointListItem");


}
catch (Exception exe)
{
MessageBox.Show("Error" + exe);

}


}
 
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