Michael's profileMichael's Coding DenBlogListsSkyDrive Tools Help
    20 May

    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

    Comments (4)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    4 Nov.
    2 Nov.
    31 Oct.
    28 Oct.

    Trackbacks

    The trackback URL for this entry is:
    http://laflour.spaces.live.com/blog/cns!7575E2FFC19135B4!1055.trak
    Weblogs that reference this entry
    • None