So I've got a list with a BDC External Data field (Sharepoint 2010). This has been added via code and works well (although some sharepoint hacking was needed!)

Anyway on the front end you go to list settings, edit the "External data" column and you can choose to "Add a column to show each of these additional fields:" and then pick the properties you want

Does anyone know how to do this from code?? Everything else in my deployment is from code so I dont want a manual step as it will get forgotten

Hows its done on the front end

1 Answer 1


You can set the "additional fields" using the SetSecondaryFieldsNames method. You can retrieve the list of secondary fields using the GetSecondaryFieldsNames method.

  • So I have a had a play with this and it works if I do it on teh list field. But does not if I do it on the content type. I get a random "object reference is set to null" when I do the update Commented Aug 10, 2011 at 4:58
  • sorry meant site column not content type Commented Aug 10, 2011 at 5:04
  • That's right...there's no container object (i.e. list or content type) for the underlying implementation to add the secondary fields/columns too when dealing with a site column, so it throws and "object reference is set to null" error. That's 100% what I would expect to happen.
    – Rob D'Oria
    Commented Aug 10, 2011 at 5:30
  • Just to note, you cannot create a Site Column of type "External Data" thru the UI.
    – Rob D'Oria
    Commented Aug 10, 2011 at 13:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.