Creating SharePoint 2010 BDC list instances in programmatically

When building out your solution in Visual Studio there is a bit of a problem whne it comes to how you actually define your external list connectivity for your external lists.

All of the other list templates seem to have all of the required information to function but External list template leaves the configuration up to you to figure out.

In any case, assuming you already have your BDC Model provisioned, here is how you can create you own external list instance in SharePoint:

1. In your Visual Studio solution structure create a `Lists` folder and add a new item of type `List instance` to it.

2. On a next page define all of the desired values except the type of the definition you want to instantiate – this one should be set to External List. At the of writing this sample I could not find `External List` definition in my VS 2010 RTM which previously was there in RC. If that`s the case for you create an instance of `Custom list` and follow to the next step. Otherwise proceed to step 5.

3. In the newly created list instance open Elements.xml and rename the following attributes of ListInstance:
a. TemplateType: 600
b. FeatureId: “00BFEA71-9549-43f8-B978-E47E54A10600”

4. Above parameters can be obtained from the External List template definition located here: [Drive]:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\ExternalList The `FeatureId` is located in Feature.xml and `TemplateType` is located there ListTemplates\ExternalList.xml

5. Now that you have an external list instance set, insert the following code into the list definition XML right before </ListInstance>:


<Property Name=”LobSystemInstance” Value=”Your instance” />

<Property Name=”EntityNamespace” Value=”NamespaceName.EntityName” />

<Property Name=”Entity” Value=”EntityName” />

<Property Name=”SpecificFinder” Value=”ViewMethodNameItem” />


For each of the property values from the code above you need to replace the dummy values with the values of your external content type.

To locate the details of your external follow the steps below: 1. Navigate to the Central Administration for your site.

2. Under Application Management category click Manage Service Applications.

3. Locate and click Business Data Connectivity Service.

4. If you have successfully deployed the BDC Model before you will see it`s details here.

Once you have transferred all of the values to your list definition, perform deploy from within Visual Studio. Navigate to the root of your portal and you will see the list provisioned with all of the values and functions that you defined before in your BDC Model.

Good luck!

About the author: Yaroslav Pentsarskyy