title: Sharepoint event handler not firing
body: <p>I have created an event handler for ItemAdded so that when an item is added on the site, my code checks to see if it's a folder. If it is, it should change the content type of that folder to a custom content type.</p>
  
  <p>The event isn't firing, so I was wondering if I'm doing it the right way and/or in the right place. Here is my code:</p>
  
  <pre><code>public class ItemAddedHandler : SPItemEventReceiver
  {
  public override void ItemAdded(SPItemEventProperties properties)
  {
      base.ItemAdded(properties);
  
      SPListItem listItem = properties.ListItem;
      SPList list = properties.ListItem.ParentList;
      SPContentType contentType;
  
      if (listItem.FileSystemObjectType == SPFileSystemObjectType.Folder &amp;&amp;
         (list.Title == "Apps" || list.Title == "Data" || list.Title == "Public"))
      {
          contentType = list.ContentTypes["Custom Folder"];
  
          listItem["Content Type"] = contentType.Name;
          listItem["Content Type ID"] = contentType.Id.ToString();
          listItem.SystemUpdate();
      }
  }
  }
  </code></pre>
  
  <p>Please let me know if I'm doing anything wrong to accomplish this task. Thanks very much in advance.</p>
  
  <p>As requested, the feature was adding with the following method:</p>
  
  <ol>
  <li>Signed and compiled above code and copied DLL to server</li>
  <li>Copied DLL to GAC</li>
  <li><p>Created folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\SPEventHandler
  4.Created Feature.xml using GUID generated with Visual Studio:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Feature Scope="Web" 
    Title="Added Event Handler" 
    Id="{27C2FDFF-ADA0-4984-955C-6448E182FA88}" 
    xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
    &lt;ElementManifests&gt;
      &lt;ElementManifest Location="Elements.xml"/&gt;
    &lt;/ElementManifests&gt;
  &lt;/Feature&gt;
  </code></pre></li>
  </ol>
  
  <p>5.Created Elements.xml using PublicKeyToken of DLL in GAC and ListTemplateID for working with a document library (101):</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8" ?&gt;
      &lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
        &lt;Receivers ListTemplateId="101"&gt;
          &lt;Receiver&gt;
            &lt;Name&gt;AddedEventHandler&lt;/Name&gt;
            &lt;Type&gt;ItemAdded&lt;/Type&gt;
            &lt;SequenceNumber&gt;10000&lt;/SequenceNumber&gt;
            &lt;Assembly&gt;SPEventHandler, Version=1.0.0.0, Culture=neutral, 
                PublicKeyToken=f2e7de6c4a924a03&lt;/Assembly&gt;
            &lt;Class&gt;SPEventHandler.ItemAddedHandler&lt;/Class&gt;
            &lt;Data&gt;&lt;/Data&gt;
            &lt;Filter&gt;&lt;/Filter&gt;
          &lt;/Receiver&gt;
        &lt;/Receivers&gt;
      &lt;/Elements&gt;
  </code></pre>
  
  <ol>
  <li>Ran the following command on the server: 
  <blockquote>
    <p>stsadm -o installfeature -filename SPEventHandler\Feature.xml</li>
    <li>On the site (SP 2007), Site Actions -> Site Settings -> Modify All Site Settings -> Site features and activated "Added Event Handler"</li>
    </ol>
  
  <p>After these steps, creating a new item in a list on this site does not seem to do anything, including writing to the event log, so I'm wondering if it is even getting run at all.</p>
  </blockquote></p>
  
  <p>Thanks</p>