I have created a page layout using module and aspx page


<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage" MasterPageFile="~masterurl/default.master" %>

<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
        <div style="float: left; width: 70%">
                ID="ActivityStream" runat="server"
                Title="First Web Part Zone" />
        <div style="float: right; width: 30%">
                    ID="Announcements" runat="server"
                    Title="Second Web Part Zone" />
                    ID="Birthdays" runat="server"
                    Title="Third Web Part Zone" />
                    ID="PopularPosts" runat="server"
                    Title="Fourth Web Part Zone" />

Module - Element.xml code

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MyModule" RootWebOnly="TRUE" Url="Pages">
    <File Path="MyModule\MyLayout.aspx" Url="MyModule\MyLayout.aspx" Type="GhostableInLibrary" />

The above code runs successfully when I change Url in the above Element.xml file to _catalogs/masterpage it doesn't deploy properly.

I also want to include this page layout in the pageLayout dropdown.

enter image description here

  • Does your file get deployed to _catalogs/masterpage/MyModule/ ? – James Grizzle Oct 31 '16 at 18:48
  • Also what is your feature scope set to? (Web, Site Collection, web application, farm) – James Grizzle Nov 1 '16 at 13:07
  • My feature scope is Site – Madhu Nov 1 '16 at 14:28

You are using RootWebOnly="TRUE" which will only show the page layout on the top level site of the Site Collection. Also it looks like you are missing some values from your elements file. This is an example from my elements file (your PublishingAssociatedContentType would be different):

<Module Name="Branding" Url="_catalogs/masterpage" List="116">

    <File Path="Branding\Home.aspx" Url="Home.aspx" Type="GhostableInLibrary" Level="Published" ReplaceContent="true">
      <!-- Page Layout Options -->
      <Property Name="ContentTypeId" Value="0x01010007FF3E057FA8AB4AA42FCB67B453FFC100E214EEE741181F4E9F7ACC43278EE81100B432574477BA904292DFD58D26CE0E24" />
      <Property Name="UIVersion" Value="15" />
      <Property Name="ContentType" Value="Page Layout" />
      <Property Name="_ModerationStatus" Value="0" />
      <Property Name="FSObjType" Value="0" />
      <Property Name="PublishingAssociatedContentType" Value=";#HomePage;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D006C1FE3D72BB549E4BD955E452EE10409;#" />
      <!-- Specific Options -->
      <Property Name="Title"
                Value="Home" />
      <Property Name="MasterPageDescription"
                Value="Home Page Layout" />
      <Property Name="PublishingPreviewImage"
                Value="~SiteCollection/_catalogs/masterpage/en-US/Preview Images/ArticleBodyOnly.png, ~SiteCollection/_catalogs/masterpage/en-US/Preview Images/ArticleBodyOnly.png" />
  • For Content TypeId and PublishingAssociatedContentType Value I have to create content type right – Madhu Nov 1 '16 at 11:29
  • I think that is the default ContentTypeId. – James Grizzle Nov 1 '16 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.