My current SharePoint project involves setting up lists in the browser then packaging them as features for deployment. To export the lists we are using SharePoint Solution Generator (the one good part of VSeWSS). This works well as a one time process but since some manual cleanup is needed to handle lookup fields any later changes probably need to be done by manually editing schema.xml.


If you need to add an additional field in schema.xml it is reasonably easy to copy an existing field definition. However there are some attributes that can’t be copied as is. Actually I suspect that most of the attributes exported by solution generator are unnecessary, but I don’t like to mess with them too much as it can be hard to tell whether or not Xml changes have taken effect.


The attribute colname indicates how the field will be stored in the underlying database. There are two things to watch for when setting this:


**Duplicates **

Trying to store two values in the same column won’t work unless you also mess with rowordinal, which I wouldn’t recommend. The error this produces when you try to create the list is at least reasonably clear and the log file tells you which column is causing the problem.


**Column limit exceeded **

This one took a bit of tracking down because the error is one that normally only appears in SharePoint 2003:


**Column Limit Exceeded **


**There are too many columns of the specified data type. Please delete some other columns first. **

**Note that some column types like numbers and currency use the same data type. **


SharePoint 2007 lets you create thousands of columns (albeit with some performance limitations). Full details can be found in MOSS 2007 Column Limitations. However, because SharePoint supports this by adding additional rows rather than columns, the fixed limit still applies to column names. The first solution you try to the duplicates is increasing the numbers and trying to put something into int17 will fail.


Fortunately the solution is simple - remove the colname attribute altogether.