none
Configure Business Data List Web Part programmatically RRS feed

  • Question

  • Hi dears,

     

    I need to configure a Business Data List Web Part and link it with a defined External Content Type programmatically during a deployment procedure.

    To do this, I retrieve the External Content entity with the following code:

     

     

    using (SPSite site = new SPSite("URL"))
    {
      using (new Microsoft.SharePoint.SPServiceContextScope(SPServiceContext.GetContext(site)))
      {
        BdcService service = SPFarm.Local.Services.GetValue<BdcService>(String.Empty);
        IMetadataCatalog catalog = service.GetDatabaseBackedMetadataCatalog(SPServiceContext.Current);
    
        // Retrieve the External Content type entity.
        IEntity entityForBdlwp = null;
        foreach (IEntity ect in catalog.GetEntities("*"))
        {
          // CODE TO RETRIEVE THE SPECIFIC CONTENT TYPE.
        }
      }
    }
    

     

     

    Then, I wish to create (or replace) the corresponding Data Source in my Business Data List Web Part. However, it seems that the BusinessDataListWebPart class doesn't authorize a such operation (serveral methods are read only or intended for internal use).

    Could you tell me how I could change the Data Source to link automatically my Web Part with the External Content Type?

    Thanks in advance for your help.

     

    Regards.

    Tuesday, January 31, 2012 9:12 AM

All replies