SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 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;

    web.AllowUnsafeUpdates = safeUpdates;

The problem I have is that the ShowInEditForm and ShowInNewForm not saved to the fields.

The event is a synchronous event. The field is an Taxonomy field, maybe that's the problem.

share|improve this question
Are you sure that your EventReceiver is called after the list creation? Did you try to put a breakpoint in the method and debug it? – Norbert Dec 12 '12 at 11:18
Yes i'm sure. It's running the code – Active_t Dec 12 '12 at 11:23
I would try making this Added event synchronous. This way it will run 100% AFTER the list has been committed to the database. – Norbert Dec 12 '12 at 11:35
It's already synchronous – Active_t Dec 12 '12 at 11:42
ListAdded is not synchrous. ListAdding is. – Dominic Goulet Sep 4 '13 at 13:29

You are missing this line :

VanField.PushChangesToLists = true;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.