Below is code snippet:
using (SPSite site = new SPSite("site url"))
{
using (SPWeb Web = site.OpenWeb())
{
SPList list = Web.Lists["MyCustomList"];
// Add new item in List
SPListItem item = list.Items.Add();
item["Title"] = “My Title”;
item["Description"] = “My Description”;
item.Update();
}
}
using (SPSite site = new SPSite("site url"))
{
using (SPWeb Web = site.OpenWeb())
{
SPList list = Web.Lists["MyCustomList"];
// Add new item in List
SPListItem item = list.Items.Add();
item["Title"] = “My Title”;
item["Description"] = “My Description”;
item.Update();
}
}
No comments:
Post a Comment