Publishing Content Types and missed “CreatePage.aspx” page in WCM sites

SharePoint content types is very popular thing, and used in almost all Sharepoint projects. Deployment of content types via feature is described in almost every book about SharePoint, but non of them describe how to do in correctly :,,) This happens mostly because the real nature of deployment content types reveals in Web Content Managed (WCM) projects, where you are working with content types inherited from publishing types. And there is no Sharepoint WCM book yet.

So, what”s exactly specific in publishing content types for WCM? It”s the nature on publishing types and using content types in publishing lists, such as “Pages” for example.

image

If to follow the standard practices in deployment of content types via feature, but inherited from any “Publishing” types and then add your custom content type to specific list (let”s consider “Pages” list) you will find a bit strange results.

Adding new custom publishing content type pages will fail in that scenario – you will be redirected to “UploadPage.aspx” page, not to “CreatePage.aspx” page where you usually create new pages for your custom publishing content types.

The problem in that, if you create the content type inherited from publishing types, and don”t specify the “CreatePage.aspx” template pages explicitly then you will loose the ability to create new pages for your content types in list toolbar menu (like on the screen above).

Actually it depends how you are adding new content type page – via Site Action menu, or via List toolbar menu. I realized that adding new page for custom publishing type fails from list toolbar menu (in default screnario), and works if you add it via Site Action menu.

The workaround is next – add the reference to “CreatePage.aspx” template explicitly using the <DocumentTemplate> tag inside the <ContentType> feature tag. The code-snipped is following

<ContentType

        ID=”0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900<GUID>”
        Name=”my Publishing Content Type”
        Group=”my Publishing Content Type”
        Description=”Content Type inherited from Publishing Page”
        >
        <FieldRefs>
            <FieldRef ID=”{<GUID>}” DisplayName=”Title” Name=”Title” Sealed=”TRUE” />
            <FieldRef ID=”{<GUID>}” DisplayName=”Description” Name=”Comments” />
        </FieldRefs>
        <DocumentTemplate TargetName =”/_layouts/CreatePage.aspx”/>

</ContentType>

When you deploy this content type via feature and add this content type to the list, “CreatePage.aspx” become available and you could create your publishing content via list toolbar menu. The work is done 🙂

Another trick is how to make your publishing content type available in specific list during feature deployment. For this reason you need to use following tag inside feature deployment xml

<ContentTypeBinding
    ContentTypeId=”<LIST ID where your content type should be added>”
    ListUrl=”$Resources:cmscore,List_Pages_UrlName;”
/>

 

Mirror: Publishing Content Types and missed “CreatePage.aspx” page in WCM sites

2 Comments »

  1. Matthew Cosier Said,

    January 29, 2009@ 11:59 pm      Reply

    You can also change the document template for the content type after it”s created by entering the advanced settings page for the content type.

    M

  2. Amit Chougule Said,

    January 11, 2010@ 6:57 am      Reply

    Hi Michael,

    Scenario.
    1. Content types are developed inheriting from List Item
    2. These content types are applied on List
    3. Page Layouts are deployed under “Pages” and DLL’s in Gac.
    4. Creation of New records succeeds, However, Attempt to View or Edit the item results into an error as shown in the attachment.

    I think this has got something to do with Page Layout’s not being able to link/work in a correct manner with Content types inheriting from List Item.

    If we try to replace the ListId=”guid”&ID=1, guid parameter with actual List Name, Edit functionality works. But this isn’t a correct mechanism.

    Let me know your thoughts and Pointers if any.


RSS feed for comments on this post · TrackBack URI

Leave a Comment