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?
-
check this one gallery.technet.microsoft.com/scriptcenter/…– Waqas Sarwar MVP ♦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.– J TApr 28, 2015 at 15:10
-
right, i think then Amal's answer is the best approach.– Waqas Sarwar MVP ♦Apr 28, 2015 at 15:14
1 Answer
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
- Create ECT using SharePoint Designer
- Now you can export the ECT to the
bdcm
file - 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
-
-
You can edit the bdcm file using any text editor and change the connection details Apr 6, 2017 at 9:59