Understanding SharePoint Journal Issue 2 released

So, the second issue is out, this time dealing with SharePoint content type development. I did a pre-launch special event for the USPJ mailing list, and the response was really great.

SharePoint content type development holds many exciting opportunities but also a lot of pitfalls. Throughout issue 2 I’ll guide you through several scenarios and answer a lot of the questions I have received and found during the last couple of years.

The issue webpage has all the details, including a free preview as a downloadable PDF. The issue is 71 pages long and costs just $14.95.

You can, of course, just buy now if you like, just click the button below to add the issue to your shopping cart.


Add to Cart

Found this article valuable? Want to show your appreciation? Here are some options:

a) Click on the banners anywhere on the site to visit my blog's sponsors. They are all hand-picked and are selected based on providing great products and services to the SharePoint community.

b) Donate Bitcoins! I love Bitcoins, and you can donate if you'd like by clicking the button below.

c) Spread the word! Below, you should find links to sharing this article on your favorite social media sites. I'm an attention junkie, so sharing is caring in my book!

Pin It

High Praise: NNUG Kristiansand

I was recently invited to speak at the the Norwegian .NET User Group meeting in Kristiansand. I held two sessions on Wednesday, March 25, 2009. The topic of the sessions were SharePoint Development 101 and a short guided tour of SharePoint development tasks.

Now, I didn’t write this to talk about the sessions, but rather to praise the NNUG Kristiansand crew and attendees for an excellent meeting. Kalle and the other people did a marvelous job of making me feel welcome and to fix all the administrative tasks of holding the event. I especially enjoyed the post-event geekbeer and the talks we had there.

For any speakers considering speaking at NNUG Kristiansand: Do it! I had a great time and I think you will too.


Pin It

List columns in a SharePoint content type? How is that possible?

One thing struck me as odd. SharePoint content types can only contain references to existing site columns. You cannot add a new column to a content type, you must first create a new site column and then add that site column to the content type. You shouldn’t be surprised at this if you have developed a few content types in your life.

So, tell me, or actually, I’ll tell you in a moment, why, when you have multiple content types in a list, and you create a new list column, are you asked whether you want to add the new list column to all content types?


This really shouldn’t be possible. SharePoint content types can only contain references to site columns, and, last time I checked, list columns != site columns.

Not just that, but by default, if you only have a single content type in your list or library, any new list or library columns are automatically added to the default content type. This puzzle must be solved!

The mystery becomes clearer if you examine how a content type is stored in SharePoint. You can do this by examining the output from the SPContentType.SchemaXml property, or, as I do, use SharePoint Manager 2007 to examine this property.

If you have read the Fast Track to Feature Generation on SharePoint Magazine, or the expanded version in Building the SharePoint User Experience book, you know that the SchemaXml output is not directly usable for a new content type defined in CAML. In fact, when you export the SchemaXml property you get Fields instead of FieldRefs, and you need to change the Field elements to FieldRef elements in order for your content type to be deployable as a feature.

The SchemaXml property of a content type contains Fields because SharePoint does not store the references to site columns at all, but rather makes a copy of those columns and stores the copy as a Field in the content type.

You may wonder why this is a good idea. The reason, quite simply, is that it allows you to customize a list column on a content type basis. You may have seen the most basic of examples of this if you go to edit a site or list column in a content type, where you will be allowed to change the required, optional, or hidden state of a column.


Now, with this knowledge you might think that since a content type stores fields you should be able to modify other settings than required, optional, and hidden. For example, you might want to do something like this:

SPContentType ct = list.ContentTypes[“My Content Type”];

SPField field = ct.Fields[“List column”];
field.Title = “Custom list column”;

but if you do you will only get an exception, “This functionality is unavailable for fields not associated with a list.”


Fear not, young Skywalker, there is help in another method, namely updating the FieldLinks of the content type:

SPContentType ct = list.ContentTypes[“My Content Type”];
SPFieldLink fieldLink = ct.FieldLinks[“List_x0020_column”];
fieldLink.DisplayName = “Customized list column”;

Note that you must reference the internal name of the column (List_x0020_column) instead of the display name, and that you update the content type (ct.Update()) instead of the SPFieldLink.

The result?


Cool, eh? Sadly, the default SharePoint user interface does not let you change this.

Before I let you go I just want to show you the IntelliSense list for SPFieldLink, because it holds and interesting property:


See the Customization property? I have absolutely no idea what that does. The documentation doesn’t say, and as far as I have been able to tell, it is not used in any default SharePoint functionality. Reflecting the SPFieldLink class reveals nothing interesting; just a fairly standard getter and setter, a slightly more complex setter, but otherwise nothing special.

Perhaps this could be used for something interesting? I can certainly think of scenarios where having custom data connected to a particular column in a particular content type might be useful.

I’ll leave that for another show.


Pin It