SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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 need to attach an event receiver to a content type created by SharePoint:

        FolderCT.EventReceivers.Add(SPEventReceiverType.ItemAdding, SharepointReceiversAssemblyName, CTReceiverName);

Unfortunately I get the error:

Folder at "/" is sealed

So, to go around the problem - I'm running the whole snippet under elevated privileges, and I'm setting Sealed to false. Is this a bad idea?

            SPContentType FolderCT = web.ParentWeb.ContentTypes[SPBuiltInContentTypeId.Folder];
            FolderCT.Sealed = false;

            FolderCT.EventReceivers.Add(SPEventReceiverType.ItemAdding, SharepointReceiversAssemblyName, CTReceiverName);

            FolderCT.Sealed = true;
share|improve this question
up vote 4 down vote accepted

As long as you reseal it again, as you do, I do not see a problem.

Here's a snippet regarding the purpose of sealing:

Sometimes, you want to make absolutely sure that someone can’t go in and change your content type via the Windows SharePoint Services user interface. If an administrator were to delete or rename columns in your content type this can cause all sorts of issues as things may or may not be prorogated down to the child types. You might also want to ensure that a content type is only created / modified by using a feature and CAML. To solve this, a content type can be marked as sealed and it can only be marked as sealed through the object model. This prevents any casual changes to the content type via the user interface.


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.