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 have developed a custom content type and a custom page layout that is inheritted, in visual studio for my publishing site. I am setting the default page layout of the site programmatically, in event receiver(feature activated).But do i need to bind my custom content type to Pages library? If i should, then how to achieve this? Is ContentTypeBinding suitable for my situation. Or is it used only in site definitions?

RootWebOnly="TRUE" | "FALSE"/>
share|improve this question
up vote 1 down vote accepted

As soon as you are using the Page Layouts just for what they're intended to (that is, assigning it to a new page), I think it's not necessary to explicitly add the content type to the Pages Library.

Just by adding the Page Layout to the "_catalogs/masterpage" folder as "GhostableInLibrary", and associated with the needed content type, will make them available when you create a new page.


<Module Name="PageLayouts" Url="_catalogs/masterpage" RootWebOnly="TRUE">
    <File Path="PageLayouts\MyPageLayout.aspx" Url="MyPageLayout.aspx" Type="GhostableInLibrary">
        <Property Name="Title" Value="My Page Layout" />
        <Property Name="PublishingAssociatedContentType" Value=";#Welcome Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#" />
        <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;" />

If, for another reason, you need the content type to be available on the Pages library, you can attach it programmatically in the same "FeatureActivated" event receiver, following a guideline such as the one provided in MSDN:

share|improve this answer
As in your case you have to add this Custom Content type to Pages library, because you are using "Custom Content Type" and "Custom page layout". Above given answer is correct in case if you are using custom page layout but already existing content types in Pages Library, than offcourse you don't need to do that. Regards, faisal – faisal rafique Dec 3 '13 at 11:21

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.