mo.notono.us

Monday, January 28, 2008

MOSS: Computed Columns - Part 2: They CAN be SiteColumns, a.k.a SiteColumns CAN be "Computed"

a.k.a. the SharePoint UI fails to tell the complete story, once again.

It turns out Computed Columns can indeed be SiteColumns.  Like an idiot, when I was failing last week to create Computed SiteColumns, I gauged my success and failure by what the SharePoint Site Column Gallery (i.e. _layouts/mngfield.aspx) was telling me.

I should have remembered that SharePoint lies.  At least by omission.  My Computed Columns are indeed there in the RootWeb's Fields, they just don't show up in the Site Column Gallery, nor in the Field listing for the Edit Contant Type Page (_layouts/ManageContentType.aspx).  This really is no different from a host of OOTB SharePoint fields, like all the various Name fields, for instance.

To add a Computed SiteColumn to your ContentType you'll have to edit the content type Schema either in xml, or my preferred method, in code through the FeatureActivated method of an inherited SPFeatureReceiver class.  It'll then show up in the list of fields in the Edit Content Type page, but the field name will not be clickable.

Just one more reminder to use Carsten Keutmann's excellent (and open-source and free!) SharePoint Manager 2007 tool instead of the SharePoint UI when checking your schema code.

Labels: , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home