i am trying to update a listitem in a event receiver on FeatureActivated in a document library.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = SPContext.Current.Site)
{
using (SPWeb myweb = site.OpenWeb())
{
SPList list = myweb.Lists.TryGetList("Document Library");
SPListItemCollection items = list.GetItems();
for (int i = 0; i < items.Count; i++)
{
SPListItem item = items[i];
Guid fieldID = item.Fields.GetFieldByInternalName("Age").Id;
string valueField = item[fieldID].ToString();
valueField = "";
item.Update();
}
}
}
});
}
My field does not get empty?