0

How can I create a Business Data catalog field with the object model? So I want to create a field that utilities business data catalog and not add an item to an already existing list.

1 Answer 1

1

You will have to be a bit more precise. BDC fields are used in many places and can be defined in many ways: application definitions, user profiles, lists, lobsystems in web parts etc.

below is an example on how to instantiate a BDC field in an SPList, as this is something that usually causes a bit of trouble:

SPListItem item = someList.Items.Add();

// assign fields
..
item["MyProductID"] = EntityInstanceIdEncoder.EncodeEntityInstanceId(new object[]{"1234"}); // this could also be an integer 
..
item.Update();// alternatively use SystemUpdate
2
  • What I meant was that I want to create a list with the object model and then add a field to the list which is a Business Data Catalog field. So I want to add a field and not and item to the list.
    – Anonymous
    Commented Mar 25, 2010 at 12:25
  • Havent tested this myself, but found another question with answer on Microsoft forum: social.msdn.microsoft.com/Forums/en-US/sharepointbdc/thread/… You add field using AddFieldAsXml() and the xml definition for the field, and then connect it as a BusinessDataField using system instance, entity and field. Commented Mar 25, 2010 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.