title: Updating already-deployed SharePoint content types to handle additional item events
body: <p>I have a site content type that was used for a handful of lists throughout my site collection.  In that content type, I describe an event receiver to handle the ItemAdding event.  This works fine.  Now I need to update the content type so that ItemUpdating is also handled.  Off the top of my head, I tried simply modifying the xml for my content type, since this seemed to allow for easy version tracking.  This worked in the sense that my updates were applied to the site content type, but not to my lists that had been using this content type.  This much was expected.  Then I noticed that the SharePoint SDK takes a <a href="http://msdn.microsoft.com/en-us/library/ms479975.aspx" rel="nofollow noreferrer">grim view</a> of that:</p>
  <blockquote>
  <p>Under no circumstances should you
  update the content type definition
  file for a content type after you have
  installed and activated that content
  type. Windows SharePoint Services does
  not track changes made to the content
  type definition file. Therefore, you
  have no method for pushing down
  changes made to site content types to
  the child content types.</p>
  </blockquote>
  <p>The SDK then points to a couple sections which describe how to use the UI or code to push changes.  Since the UI offers no hook into event receivers, I guess I will be choosing the code path.</p>
  <p>I thought I'd be able to do something like this and just add a new event receiver to the list's copy of the content type:</p>
  <pre><code>SPList list = web.Lists[&quot;My list&quot;];
  SPContentType ctype = list.ContentTypes[&quot;My content type&quot;];
  // Doesn't work -- EventReceivers is null below.
  ctype.EventReceivers.Add(SPEventReceiverType.ItemUpdating, 
                           &quot;My assembly name&quot;, &quot;My class name&quot;);
  </code></pre>
  <p>But the catch is that ctype.EventReceivers is null here, even though I have ItemAdding already hooked up to this list.  It appears that it was moved to the list itself.  So, the list has a valid EventReceivers collection.</p>
  <pre><code>SPList list = web.Lists[&quot;My list&quot;];
  list.EventReceivers.Add(SPEventReceiverType.ItemUpdating, 
                          &quot;My assembly name&quot;, &quot;My class name&quot;);
  </code></pre>
  <p>So, I have a couple questions:</p>
  <ol>
  <li>Is the correct way to do this just to add any new event receivers directly to the list and just forget about my content type altogether?</li>
  <li>To accomplish this change, what's the best way to handle this in terms of configuration management?  Should I create a simple console app to find all the appropriate lists and modify each of them?  Or is somehow creating a Feature a better option?  Either way, it seems like this change is going to be off on its own and difficult to discover by future devs who might need to work with this content type.</li>
  </ol>