I am adding a new splistitem to a sharepoint list but it always gives me an exception: "object refer
Posted
by Manale
on Stack Overflow
See other posts from Stack Overflow
or by Manale
Published on 2010-04-08T06:31:47Z
Indexed on
2010/04/08
6:33 UTC
Read the original article
Hit count: 320
_site = new SPSite("http:\\MySite");
_web = site.OpenWeb();
{
list = _web.Lists[sListName];
_web.AllowUnsafeUpdates = true;
items = list.Items;
item = items.Add();
item["Title"] = "new Title";
item["UserName"] = CurrentUser.ToString();
item["Configuration"] = sConfiguration.ToString();
}
item.Update();
_web.AllowUnsafeUpdates = false;
© Stack Overflow or respective owner