title: SharePoint 2010 event receiver,List Item Events, Document library,event ItemAdded not firing
body: <p>in SharePoint Server 2010 i have a document library and i want to create sub-folders every time a folder created, i have a code snippet but it's not working, i tried to debug but also the event isn't firing, could any one help me please and here is my code:</p>
  
  <pre><code>public class EventReceiver1 : SPItemEventReceiver
  {
      /// &lt;summary&gt;
      /// An item was added.
      /// &lt;/summary&gt;
      private string[] subFolders = new string[] { "sub-folder1", "sub-folder2", "sub  folder3" };
      public override void ItemAdded(SPItemEventProperties properties)
      {
          base.ItemAdded(properties);
          SPWeb web = properties.OpenWeb();
          SPDocumentLibrary ProductsLibrary = (SPDocumentLibrary)web.Lists[properties.ListId];
          if (properties.ListItem.ContentType.Name.ToLower() == "new content type" &amp;&amp; properties.ListItem.Folder.ParentFolder.ToString() == ProductsLibrary.RootFolder.ToString())
          {
              string Url = properties.ListItem.ParentList.RootFolder.ServerRelativeUrl.ToString();
              SPFolder libFolder = ProductsLibrary.RootFolder.SubFolders[properties.ListItem.Name];
              string newFolderUrl = (web.Url + "/" + libFolder.ToString());
              foreach (string subfolder in subFolders)
              {
                  SPListItem newSubFolder = ProductsLibrary.Items.Add(newFolderUrl, SPFileSystemObjectType.Folder, subfolder);
                  newSubFolder.Update();
              }
          }
      }
  }
  </code></pre>
  
  <p>thank you </p>