How to create a BCS (Business Conectivity Services) column programatically?

Beantwortet How to create a BCS (Business Conectivity Services) column programatically?

  • 2010年10月13日 10:25
     
     

    Hi,

    I have a SP2007 app that adds a BDC column to a list like this:

      string xml = "<Field Type=\"BusinessData\" DisplayName=\"Product\" ...>"; 
      SPField fld = list.fields.AddFieldAsXml(xml, true, addOptions);

      BusinessDataField bdcField = fld as BusinessDataField;
      bdcField.SystemInstanceName = instance;
      bdcField.EntityName =         entity;
      bdcField.BdcFieldName =       bdcFldName;
      bdcField.Profile =            profile;
      bdcField.HasActions =         hasActions;

      bdcField.Update();

    How do I do it in SP 2010? Class BusinessDataField  does not exist in Microsoft.SharePoint.Portal.WebControls,
    and I found no samples.

    Thanks in advance
    Sruli

     

すべての返信

  • 2010年10月18日 9:23
     
     回答済み

    Hi, Sruli

     

         Did you wish to add BCS column with code?

         In SharePoint 2010, we could use SPBusinessDataField instead.

         The article below from Tom gave a good sample for creating a BSC field with server side OM and list schema:

         http://tom-dw.blogspot.com/2010/08/sharepoint-2010-use-bcs-lookup-field-in.html

         Hope this can help!                                                                                                                         

            

    Best Regards,

    Aaron

    • 回答としてマーク Wayne Fan 2010年10月21日 2:40
    •  
  • 2010年10月18日 10:27
     
     

    Hi Aaron,

    Yes, this helps a lot. Many thanks.

    Strangely, all my Goggle searches for info led me to SP 2007.

    Sruli