Wednesday, July 27, 2016

Customize Display, Add and Edit Forms for SharePoint Custom Lists Errors

Column “Publishing Page Layout” does not exist, it may have been deleted by another user.


For developers who are working on custom solution on top of SharePoint server, this error that you may face if you wanted to customize display, edit and new forms for custom content types in SharePoint, in my scenario I created a publishing page and I am adding custom webparts to this page by using page module.

At first when you create custom content types that will be bound to list, and these content types have default edit, display and new forms then you have to create an event receiver to update the forms as below sample code.


Then when you create a new task, you will be redirected to the custom form page url, and the below error will be thrown.
System.ArgumentException: Column 'PublishingPageLayout' does not exist. It may have been deleted by another user


To fix this error, you need to add custom document properties to the aspx page html as below,
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head> 
<!–[if gte mso 9]><SharePoint:CTFieldRefs runat=server Prefix="mso:" FieldList="FileLeafRef,Comments,PublishingStartDate,PublishingExpirationDate,PublishingContactEmail, 
PublishingContactName,PublishingContactPicture,PublishingPageLayout,PublishingVariationGroupID, 
PublishingVariationRelationshipLinkFieldID, 
PublishingRollupImage,Audience,PublishingIsFurlPage,SeoBrowserTitle,SeoMetaDescription, 
SeoKeywords,RobotsNoIndex,eRebEntity"><xml> 
<mso:CustomDocumentProperties> 
<mso:PublishingContact msdt:dt="string">1073741823</mso:PublishingContact> 
<mso:PublishingIsFurlPage msdt:dt="string">0</mso:PublishingIsFurlPage> 
<mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_PublishingContact msdt:dt="string">System Account</mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_PublishingContact> 
<mso:PublishingContactPicture msdt:dt="string"></mso:PublishingContactPicture> 
<mso:RobotsNoIndex msdt:dt="string">0</mso:RobotsNoIndex> 
<mso:PublishingContactName msdt:dt="string"></mso:PublishingContactName> 
<mso:ContentTypeId msdt:dt="string"> 
0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900 
B3313EDD2C4B4EAC9D8A2EA8C0F6CF1D00BE9190263CAA2946A1A8D14D4C5EBD43</mso:ContentTypeId> 
<mso:PublishingPageLayoutName msdt:dt="string">eREBStudyPage.aspx</mso:PublishingPageLayoutName> 
<mso:Comments msdt:dt="string"></mso:Comments> 
<mso:PublishingContactEmail msdt:dt="string"></mso:PublishingContactEmail> 
<mso:PublishingPageLayout msdt:dt="string"> 
http://dev.erebportal.com/_catalogs/masterpage/eREBStudyPage.aspx, /_catalogs/masterpage/eREBStudyPage.aspx 
</mso:PublishingPageLayout> 
<mso:RequiresRouting msdt:dt="string">False</mso:RequiresRouting> 
</mso:CustomDocumentProperties> 
</xml></SharePoint:CTFieldRefs><![endif]–> 
<title>Access Denied</title></head>