SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to update the Layout of the default.aspx page in my SharePoint publishing site and although the Layout does get updated, the ContentType of the page does not. Anyone have any ideas?

Based on the example below, the assert is getting thrown all the time since the content types don't match.

share|improve this question
up vote 2 down vote accepted

Sounds right to me, any given content type can use many page layouts some page layouts will even work for content types that decendants of the intended content type.

You should change the content type first then change the page layout.


share|improve this answer
For a publishing page, how do you change the content type? I thought changing the layout is supposed to automatically change the content type too. But it doesn't seem to be doing this on my SharePoint site. Oh, and just incase I wasn't clear, I'm doing this via the object model. – TehOne Mar 6 '12 at 6:31
You can change the content type of the page via the ContentTypeId field. Once that is set you can then change the PageLayout to one associated with the new content type. – GavinB May 14 '12 at 3:40
Just thought I'd come back an post an update on this. Just changing the page layout wasn't enough for me, I had to also set the ContentTypeId as @GavinB suggested. Here is a code snippet: page.Layout = newPageLayout; page.ListItem[SPBuiltInFieldId.ContentTypeId] = newPageLayout.AssociatedContentType.Id; page.Update(); – TehOne Aug 18 '12 at 2:25

You may want to change the page layout to change the look, feel, and content of the page. In that case, you can have the different layout associated to same content type.

The ContentType property value is initialized when you create a PublishingPage; this value is based on the AssociatedContentType and cannot be modified.

Another option is to recreate the page using new layout\contentType

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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