Hammendorp.net

Blogging about SharePoint and other development

I was looking for a way to update the page title of my welcome page in c# and I got to the following example:

SPWeb web = SPContext.Current.Site.OpenWeb();
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(childWeb);
SPFile defaultPage = pubWeb.DefaultPage;

defaultPage.CheckOut();
defaultPage.Update();

defaultPage.Item["Title"] = "My title";
defaultPage.Item.Update();

defaultPage.CheckIn("My comment");
defaultPage.Update();

Have fun!



Well, what an adventure. How how hard can it be, was what I thought:

  1. Create a custom content type with custom site columns
  2. Create a custom page layout
  3. Let it come together in the onet.xml of my custom site definition

(I think there are enough articles which describe the above steps in detail)

I don't know where it went wrong, but after I created a new site based on my custom site definition the following issues appeared:

  1. My custom pagelayout wasn't loading, but some default page layout (the sharepoint controls for my fields and my usercontrol were gone)
  2. I went to the pages list of my site, I did see my page and even my custom page layout (??). I can even click on the link of the page layout which shows the correct page layout
  3. When I go to the page settings the page, I am missing the option to choose a page layout 
  4. And last; If I create a new page in that list manually, it works fine!

Okay, now you want to know what the h#ll was the problem. Well, in all my experimenting and changes all around somewhere the incorrect default page was copied in my site definition.

The solution is easy (knowing what I know now):

  • Copy the default.aspx from /12/TEMPLATES/Site Templates/PUBLISHING to my own site definition folder (I have used the publising site as starting point)
  • Do an IISRESET
  • Create a new site

It seems like a stupid problem, but when you get caught up in the details you easally lose the overview. So beside this post I would like to recommend everyone with strange, inexplicable problems with Sharepoint to go back to the basic / starting point and build up you solution step by step untill you get to the problem.

Hope you can use it.



In my opinion there are two nice tools to deploy your Sharepoint Solution (WSP):

Have fun trying!



For a new project at work, I'm beginning to get the hang of content types and site columns. I think it's best practice to:

1. first think which content types you need in your project
2. create (or re-use) site columns in your content type
3. then create lists or pages based on your content type

All this is made by me in the Sharepoint UI and then exported to a feature. An interesting option to export is to use the stsadm extensions from Gary Lapointe. With this tool, you can create the elements file to use in your feature. In my experience, you still need some tweaking in the XML but other then that it's working like a charm. I'm working on a simple windows application to do the same, only with a friendly UI. If that is finished, I will probably post this on my blog.

Happy sharepointing ;)



There is a list available with all the default site templates which exist in the 12 hive. Always nice to know which site it is:

FOLDER SITE NAME
BDR Document Center
BLANKINTERNET Publishing Site with Workflow
BLANKINTERNETCONTAINER Publishing Portal
Blog Blog
CENTRALADMIN Central Administration
MPS Includes the site definition configurations for:
  • Basic Meeting Workspace
  • Blank Meeting Workspace
  • Decision Meeting Workspace
  • Social Meeting Workspace
  • Multipage Meeting Workspace
offile Records Center
OSRV Shared Services Administration
PROFILES Profiles
PUBLISHING Publishing Site
SPS SharePoint Portal Server Site (legacy - this template is obsolete)
SPSCOMMU Community area template (legacy - this template is obsolete)
SPSMSITE Personalization Site
SPSMSITEHOST My Site Host
SPSNEWS News Site (legacy - this template is obsolete)
SPSNHOME News Site
SPSPERS SharePoint Portal Server Personal Space
SPSPORTAL Collaboration Portal
SPSREPORTCENTER Report Center
SPSSITES Site Directory
SPSTOC Contents area template (legacy - this template is obsolete)
SPSTOPIC Topic area template (legacy - this template is obsolete)
SRCHCEN Search Center with Tabs
SRCHENTERLITE Search Center
sts Includes the site definition configurations for:
  • Team Site
  • Blank Site
  • Document Workspace
Wiki Wiki


Bas Hammendorp

I am Bas Hammendorp, working as SharePoint developer at PGGM Zeist

Month List

Sign in