Adding BDC Columns to a Sharepoint List

I am trying to add BDC columns to a sharepoint list programatically.

In fact the application that I am working on has 140 lists each potentially with a different set of BDC extension columns.

This is of course impossible – at least no-one is saying how to do so on the blogs.

You cannot use the simple field constructor as business data is not in the enumeration.

The trick is to extract the XmlSchema from the field and remove the offending gumph (that is the specific guids – which I now think may be the cause of my problems).

There are two methods that I have found useful:

SPField.AddFieldAsXml is the key method on the list to allow the xml to be added.

You need to tell the client which bdc provider to use:


This almost works (the fields are added, you get a cryptic error about looking in the logs yet the bdc column does not work).

I suspect that the guids that I removed are the problem.

Normally I only post working examples – this is not one of them.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s