I have an listadded eventreceiver with the following code:
public override void ListAdded(SPListEventProperties properties)
{
SPWeb web = properties.Web;
bool safeUpdates = web.AllowUnsafeUpdates;
web.AllowUnsafeUpdates = true;
SPList list = properties.List;
SPField VanField = list.Fields.GetFieldByInternalName("MyFieldName");
VanField.ShowInEditForm = false;
VanField.ShowInNewForm = false;
VanField.Update(true);
list.Update(true);
web.Update();
web.AllowUnsafeUpdates = safeUpdates;
base.ListAdded(properties);
}
The problem i have is that the ShowInEditForm and ShowInNewForm not saved to the fields.
The event is an sychronous event. THe field is an Taxonomy field, maybe that's the problem.