.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Set custom publishing page layout custom field programatically

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :SharePoint

I have a custom publishing page content type, based on the Publishing Article Page content type. On this content type, I have a custom field named "PageContentCategory". In my code to create new pages, I tried this:


PublishingPage newPublishingPage = this.currentPublishingWeb.GetPublishingPages().Add(pageName, newPageSelectedLayout);

if (pageContent.IsEmpty())
 pageContent = Properties.Resources.EAWorldArticleHandler_CreateNewArticlePage_DefaultPageContent;

newPublishingPage.ListItem[new Guid("{93496B35-7EC3-4132-B0D0-3BDC5606F5EF}")] = pageContentCategory;
newPublishingPage.ListItem[FieldId.PublishingPageContent] = pageContent;
newPublishingPage.Title = pageTitle;


I have also tried to set it by the field name:


PublishingPage newPublishingPage = this.currentPublishingWeb.GetPublishingPages().Add(pageName, newPageSelectedLayout);


View Complete Post

More Related Resource Links

Page layout - Custom Multi line field limits at 255 chars



Hi group,


I hope i use the correct terms since I have a DUTCH :-( Sharepoint version.


I created a new Site Content Type, called activity.

I added a new column (Add from new site column)

The type of this column is: Multiple lines of text.

(I choose this because single line of text can contain up to 255 chars)


In Microsoft Office Sharepoint Designer (MOSD) I created a new pagelayout (File => new => Sharepoint Content => pagelayout)

and inserted the field activity to the .aspx page.

<SharePointWebControls:NoteField FieldName="Comments" runat="server"></SharePointWebControls:NoteField>

Why is the fieldname Comments I expected Activity?


I then created a new page (in MOSS) based on the created pagelayout.


Works like a charm.

Problem: I cannot add more than 255 chars to the field activity although it is a multiline type.

Does anybody

How to set default Image to RichFieldImage control in custom Publishing Page layout in Site defini




How to set  default Image to RichFieldImage control  in custom Publishing Page layout in Site definition?


how to provision Custom page layout and master page for subsite



I want to display the following page when  subsite of type  Custom site defination is created



Module Name="Brand" Url="

How to add custom field into registration page and save it to database?


Hi all,

I try to construct a membership system using Walkthrough: Creating a Web Site with Membership and User Login. The membership system is going to be added to umbraco cms. I should admit that I am still in the learning process and need your guidance for my question.

On my registration page other than standard fields which comes with CreateUserWizard, I need to add some extra fields in addition to that and those fields should be saved to database along with standard fields.

Is it possible? If it is, how can I manage to do that?



How to create a custom page layout in sharepoint foundation 2010



I need to create a custom page layout in sharepoint foundation 2010.

I am aware that wss 3.0 and sharepoint foundation do not have the publishing infrastructure.

I need to know if the same procedure that is used to create custom web part pages in WSS 3.0 is to be used in SharePoint foundation too or are there other ways.

I am relatively a fresher to sharepoint technology.Please help.

Thanks in advance:D.


InfoPath 2010: Create custom "Table Templates" and "Page Layout Templates"


Is it possible to create your own table templates and/or page layout templates for InfoPath 2010?


Cannot edit pages based on custom page layout


Hi guys!

I have created a site definition that applies a the publishing features and a feature containing some publishing page layouts before it creates some publishing pages based on these layouts.

My problem is that once I create a site based on this definition the resulting publishing pages are not editable. Also in the site definition one of the pages have a webpart added to one of the layouts containers that it should be based on, but when I try to open the page in the browser I get the error: "One or more Web Parts on this page references a zone that doesn't exist".

It appears that either my layouts or publishing page declarations are incorrect, but I cannot for the life of me figure out where. Any help would be greatly appreciated. I've been googling this problem for well over a week now :S


The module part of my site definition:

<Module Name="Homepage" Url="$Resources:cmscore,L

How to change the display name for LinkTitle or Title field in a Custom List programatically


We have a requirement, where we need to create a list from "Custom List" Template, through a console application.
But we need to change the Display Name of the column named "Title" created by default to something else say "CategoryName". We do not want to remove the column but only change its display name, so that the column with name "CategoryName"still has a hyperlink and ECB menu attached to it..

The same can be done by going to list settings and changing the name of the Title column, but I am not able to figure out how to do it progrmatically.


"Title"].Title = "Some Other Name";
CustomListName.Fields["LinkTitle"].Title = "Some Other Name"

Use custom page layout


Hi friends,

i have MOSS 2007 and have created a custom page layout in sharepoint designer.

now i want to create a page with that layout. how can i achieve this.

if anybody knows then please let me know complete procedure

SharePoint 2010 Custom Page Layout - No Publish option available



We built several custom page layouts in MOSS which we are upgrading to SharePoint 2010. If the page layout has custom code behind, the "Publish" tab is not available in the Ribbon. But if we change the Inherits attribute of the Page Tag to default "Micrsoft.SharePoint.Publishing.PublishingLayoutPage", we see the Publish Tab.

For example if the custom page layout has <%@ Page Language="C#" Inherits="Custom Namespace,Custom Assembly,Version=,Culture=neutral,PublicKeyToken="
    meta:progid="SharePoint.WebPartPage.Document"  %> , we dont see the Publish Tab in the ribbon.

The code from the code behind file executes when we access the page.

But if we change the Page Attribute to the default

<%@ Page Language="C#" Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c"
    meta:progid="SharePoint.WebPartPage.Document" %> , we see the Publish Tab.

Any thoughts would be greatly appreciated.




Link to a custom page layout from a button


Can anyone help out with a code snippet for the Click() method in a button - that opens a custom publishing page layout (I´ve made) when clicked on.

Instead of doing this the usual way by the Site Action meny.

C# code please =)


I use SharePoint 2010.

How to automatically enable web part connections when creating a publishing page based on a custom p


I have created a simple custom page layout in SharePoint Designer, added a couple of web part zones, and a custom web part on each zone.

These web parts have a custom provider-consumer set of interfaces. I configured the connection between the web parts in SharePoint Designer (using Add Connection wizard), and saved the page layout.

After that, I checked in the layout and approved it in SP's web interface.

Finally, I created a Publishing Page based on my layout, but the connection between the web parts was not set. I can set the connection manually and it works fine, but I would like the connection to be automatically set on each page I create based on the layout.

Is this the expected behavior? If so, is there a way to configure the connection automatically either programmatically or declaratively?

Is there a step I'm missing?

Customize content query web part in custom page layout


I am trying to build a custom page layout which should have the following web parts:

1. Announcements,

2. Doc Library

3. custom list items

And the data in these web parts should be from the site in which we create this page. For example, if we try to create a page in site A, then the announcements displayed should be from site-A, doc lib that is in site-A...

And I am trying to insert a content query web part in the page layout using sharepoint designer, and modify the query to insert the announcements list in the site. But how can I query to pull the data from corresponding site.

Thanks for the help.

Office Space: Custom Field Types for SharePoint 2007


Custom field types provide a powerful way to define a reusable SharePoint column definitions.

Ted Pattison

MSDN Magazine May 2009

Silverlight: Create a Custom Expression Encoder Publishing Plug-In


Laurence Moroney demonstrates how to employ the Expression Encoder plug-in APIs by building and debugging a simple FTP upload plug-in.

Laurence Moroney

MSDN Magazine February 2008

Custom Field Control


I would like to know how can we build a custom field control in sharepoint. Following is the scenario i am looking into it:

1. Textbox control with browse button

2. When we click on browse button, need to display a popup (like business data dialog box) where i can search for project id from oracle datasource and then select the project id(s) from the search results. Selected project id(s) must be concatenated with colon or semi colon and display back to original text box.

I guess requirement is very clear. Please help me how to do this type of things in sharepoint. I have never done these type of requests earilier. Thank you very much for you help.

Creating a custom column with a link to document (other than the name field) in document library



I have a document library with the standard name column linking to the document. However, we'd like to create a custom field and have that link to the document (and edit item menu).

How is this best accomplished?

Thanks in advance!


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend