Udostępnij za pośrednictwem


How to configure Cache Profile in Page Layout using Features

Feature framework can be used to deploy Page Layouts. After you have deployed a page layout you could configure the Cache Profile that needs to be assigned to the Page Layout using UI. But what if your requirement was to pre-configure the same with deployment of page layout itself. To know the Cache Profile that needs to go with the Page Layout you need to know its Item ID and the title. Cache Profile is configured as a metadata column on the Master Page gallery. To enable the same I had to modify the elements.xml as shown below.

 

 <Elements xmlns="https://schemas.microsoft.com/sharepoint/"> 
    <Module Name="PageLayouts" Url="_catalogs/masterpage" Path="PageLayouts" RootWebOnly="TRUE"> 
        <File Url="CareerLayoutsCTFeature.aspx" Type="GhostableInLibrary"> 
            <Property Name="Title" Value="HR Page Layout" /> 
            <Property Name="MasterPageDescription" 
 Value="Page with image on top contains an image field and richtext field." /> 
            <Property Name="ContentType" Value="Page Layout" />       
            <Property Name="PublishingAssociatedContentType" 
 Value=";#HRPublishingContent;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130

EC3DB064584E219954237AF3900413CF8A8360B40d08C45631829C1FB0B;#"/> 
<Property Name="AnonymousCacheProfile" Value="2;#Public Internet (Purely Anonymous)"/> 
            </File> 
</Module> 
</Elements> 

Comments