Encouraging two-way communications

Share + Learn + Comment   Encouraging two-way communications

Discover our team’s valuable knowledge, experience, opinions, and advice. And let us know what you think!

Blog

Importing BCS Model using Powershell

Larry Lau
January 28, 2010

After creating your External Content Type in SharePoint Designer 2010, you have an option to export your external content type as XML which you can twist it further. Now you need to deploy these external content types to the production environment. SharePoint Designer is not an option since there is no "Import from XML" feature within Designer. Besides, Designer isn’t installed on the production environment anyway. The other way to do is via Central Administration. The UI is not terriblely easy to use. The import button is buried in different UI elements that can be hard to spy. Here is how you can do it in couple of lines of PowerShell script:

param(
[string]$SiteUrl=$("http://localhost")
)

Write-Host "Getting Service Context at $SiteUrl..."

$svcContet = Get-SPSiteAdministration -Identity $SiteUrl

Write-Host "Getting Business Data Catalog Metadata Object..."

$catalog = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType Catalog -ServiceContext $svcContet 

Write-Host "Importing BCS Modal..."

Import-SPBusinessDataCatalogModel -Identity $catalog -Path ".\RinkNetModel.xml" -force -ModelsIncluded -PropertiesIncluded -PermissionsIncluded -Verbose -ErrorAction Stop -ErrorVariable $err

  • Facebook
  • Twitter
  • DZone It!
  • Digg It!
  • StumbleUpon
  • Technorati
  • Del.icio.us
  • NewsVine
  • Reddit
  • Blinklist
  • Add diigo bookmark
Post a comment
  1. Formatting options
       
     
     
     
     
       

Please Upgrade Your Browser

This site's design is only visible in a graphical browser that supports web standards, but its content is accessible to any browser or Internet device.