0

Is it possible to create an external content type in SharePoint 2013 using PowerShell? For example, I have a view in a SQL database, and normally I would use SharePoint Designer to create an external content type with read and list operations on that view. Is anyone aware of resources that explain how this can be done in PowerShell?

3
  • check this one gallery.technet.microsoft.com/scriptcenter/… Commented Apr 28, 2015 at 15:00
  • @Waqas Thanks, but that article describes creating lists for ECTs that already exist. I want to create the ECTs themselves. Commented Apr 28, 2015 at 15:10
  • right, i think then Amal's answer is the best approach. Commented Apr 28, 2015 at 15:14

1 Answer 1

0

External Content Type usually get exported and imported as bdcm files. If you observe it is an XML file which basically has following information

  • External System (Information about which system it is connected)
  • Methods (Operation like Finder, Specific Finder etc)

Now I am not sure is there any API which is available to do this. I believe it will be more time consuming. So instead I would suggest

  1. Create ECT using SharePoint Designer
  2. Now you can export the ECT to the bdcm file
  3. Now you can use PowerShell to import it into other environments

PowerShell Script to Import BDCM Model File

$bdc = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType "Catalog" -ServiceContext http://siteurl
Import-SPBusinessDataCatalogModel -Path "C:\path\model.bdcm" -Identity $bdc
2
  • How do you modify the database connection? Commented Apr 6, 2017 at 6:43
  • You can edit the bdcm file using any text editor and change the connection details Commented Apr 6, 2017 at 9:59

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.