Tuesday, October 22, 2013

06 Programmatically create an External list in a feature from existing External Content Type – getting the required properties

Creating the list is fairly straight forward. Below is the code snippet that is needed in the feature

The top section is the same as any List instance. In the case of an external List we need
Type: 600 - but also can be found in the feature directory
Feature ID: 00bfea71-de22-43b2-a848-c05709900100 – also found in the features directory


The Datasource section is where we can tell the External List what External Content Type to connect to. In my case, I'm connecting to an External Content Type that was already created using SharePoint Designer. You can get the values need by exporting the External Content Type from SharePoint Designer.

Then open the resulting .BDCM file (which is really just an xml file) in either Visual Studio or Notepad (or other program you're comfortable with) First one you'll see is the LobSystemInstance (to find it quicker just search for LobSystemInstance)



Next Up is the Entity NameSpace and Name



The last piece of info we need is the SpecificFinder



Putting this together means my code would look like:

1 comment: