Friday, November 18, 2011

How to find the ID for associated content type when adding a page layout?

If you are working in SharePoint 2010 with pagelayout by using Visual Studio 2010, then while deploying the layout template you will need the content typeid. You need the id in the element.xml file in PublishingAssociatedContentType tag.

Then PublishingAssociatedContentType  should be in form ';#;#. The Content type name is the name of the content type that your page layout based on. Suppose you are making a publishing pagelayout and your content type is based on Welcome Page content type. Then to get the content type id go to Site Actions -> Site Settings then from Galleries section Select Site content types. Then choose your content type from the list of content types. I am choosing her Welcome Page from Page Layout Content Types section  as shown in the figure below.



Now check the URL as shown in the figure below in the ManageContentType page. Your id is after ctype= and before &Source= in the URL. You can copy that and paste in the Elements.xml file as shown below.


<Property Name="PublishingAssociatedContentType" Value=";#Welcome Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4;#" />