private void addListItem()
{
string siteUrl = "http://Site";
ClientContext clientContext = new ClientContext(siteUrl);
List oList = clientContext.Web.Lists.GetByTitle("Demo");
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);
oListItem["Title"] = textBox1.Text.ToString();
oListItem["Name"] = textBox2.Text.ToString();
oListItem.Update();
clientContext.ExecuteQueryAsync(onQuerySucceeded, onQueryFailed);
}
private void onQuerySucceeded(object sender, ClientRequestSucceededEventArgs args)
{
this.Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Item Succesfully Add......");
});
}
private void onQueryFailed(object sender, ClientRequestFailedEventArgs args)
{
Dispatcher.BeginInvoke(() =>
{
MessageBox.Show("Item Not Succesfully Add......");
});
}
No comments:
Post a Comment